chore(gateway, ping-service, security): streamline configurations, remove redundancies, and improve resilience
- Removed `MdcCorrelationFilter` and simplified correlation ID management using Micrometer Tracing. - Updated `SecurityConfig` in `gateway` with enhanced role-based access and standardized JWT validation. - Added new `@Profile` annotations in `ping-service` to exclude certain components during testing. - Refactored and removed legacy `application-keycloak.yaml` and consolidated settings into the primary `application.yaml`. - Adjusted Gradle scripts to clean up dependency declarations and improve modularity. - Simplified CORS and Gateway route configurations for better maintainability.
This commit is contained in:
+2
@@ -3,6 +3,7 @@ package at.mocode.ping.application
|
||||
import at.mocode.ping.domain.Ping
|
||||
import at.mocode.ping.domain.PingRepository
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.context.annotation.Profile
|
||||
import org.springframework.stereotype.Service
|
||||
import org.springframework.transaction.annotation.Transactional
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
@@ -14,6 +15,7 @@ import kotlin.uuid.Uuid
|
||||
* Hier darf Spring (@Service, @Transactional) verwendet werden, da es "Application Logic" ist.
|
||||
*/
|
||||
@Service
|
||||
@Profile("!test") // Nicht im Test-Profil laden, damit wir Mocks nutzen können
|
||||
@OptIn(ExperimentalUuidApi::class)
|
||||
class PingService(
|
||||
private val repository: PingRepository
|
||||
|
||||
+6
-2
@@ -14,6 +14,10 @@ class PingJpaEntity(
|
||||
val message: String,
|
||||
val createdAt: Instant
|
||||
) {
|
||||
// Default constructor for JPA
|
||||
protected constructor() : this(UUID.randomUUID(), "", Instant.now())
|
||||
// The default constructor for JPA
|
||||
// Protected is fine for Hibernate, but the Kotlin compiler might complain about visibility.
|
||||
// We can make it private or internal if needed, but protected is standard.
|
||||
// To suppress the warning "effectively private", we can just leave it as is or make it public/internal.
|
||||
// Let's try making it internal to satisfy Kotlin while keeping it hidden from public API.
|
||||
internal constructor() : this(UUID.randomUUID(), "", Instant.now())
|
||||
}
|
||||
|
||||
+2
@@ -2,6 +2,7 @@ package at.mocode.ping.infrastructure.persistence
|
||||
|
||||
import at.mocode.ping.domain.Ping
|
||||
import at.mocode.ping.domain.PingRepository
|
||||
import org.springframework.context.annotation.Profile
|
||||
import org.springframework.stereotype.Repository
|
||||
import kotlin.uuid.ExperimentalUuidApi
|
||||
import kotlin.uuid.Uuid
|
||||
@@ -10,6 +11,7 @@ import kotlin.uuid.toKotlinUuid
|
||||
|
||||
@OptIn(ExperimentalUuidApi::class)
|
||||
@Repository
|
||||
@Profile("!test") // Nicht im Test-Profil laden, damit wir Mocks nutzen können
|
||||
class PingRepositoryAdapter(
|
||||
private val jpaRepository: SpringDataPingRepository
|
||||
) : PingRepository {
|
||||
|
||||
+1
@@ -83,6 +83,7 @@ class PingController(
|
||||
)
|
||||
|
||||
// Fallback
|
||||
@Suppress("unused", "UNUSED_PARAMETER")
|
||||
fun fallbackPing(simulate: Boolean, ex: Exception): EnhancedPingResponse {
|
||||
logger.warn("Circuit breaker fallback triggered: {}", ex.message)
|
||||
return EnhancedPingResponse(
|
||||
|
||||
Reference in New Issue
Block a user