io.lsdconsulting.interceptors.http.autoconfigure.NamingConfig.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lsd-interceptors Show documentation
Show all versions of lsd-interceptors Show documentation
Provides various interceptors to capture events for the lsd-core library to generate sequence diagrams
package io.lsdconsulting.interceptors.http.autoconfigure
import io.lsdconsulting.interceptors.common.AppName.Factory.create
import io.lsdconsulting.interceptors.http.naming.AlwaysAppName
import io.lsdconsulting.interceptors.http.naming.DestinationNameMappings
import io.lsdconsulting.interceptors.http.naming.RegexResolvingNameMapper
import io.lsdconsulting.interceptors.http.naming.SourceNameMappings
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.context.annotation.Bean
internal class NamingConfig {
@Value("\${info.app.name:App}")
private lateinit var appName: String
@Bean
@ConditionalOnMissingBean(name = ["defaultSourceNameMapping"])
fun defaultSourceNameMapping(): SourceNameMappings {
return AlwaysAppName(create(appName))
}
@Bean
@ConditionalOnMissingBean(name = ["defaultDestinationNameMapping"])
fun defaultDestinationNameMapping(): DestinationNameMappings {
return RegexResolvingNameMapper()
}
}