diff --git a/springwolf-add-ons/springwolf-kotlinx-serialization-model-converter/build.gradle b/springwolf-add-ons/springwolf-kotlinx-serialization-model-converter/build.gradle index 1cb1d8ae3..543a91c43 100644 --- a/springwolf-add-ons/springwolf-kotlinx-serialization-model-converter/build.gradle +++ b/springwolf-add-ons/springwolf-kotlinx-serialization-model-converter/build.gradle @@ -17,8 +17,10 @@ plugins { } dependencies { + api project(":springwolf-core") + implementation "org.springframework:spring-context" - implementation "org.springframework:spring-beans" + implementation "org.springframework.boot:spring-boot-autoconfigure" implementation "io.swagger.core.v3:swagger-core-jakarta:${swaggerVersion}" implementation "io.swagger.core.v3:swagger-models-jakarta:${swaggerVersion}" diff --git a/springwolf-add-ons/springwolf-kotlinx-serialization-model-converter/src/main/java/io/github/springwolf/addons/kotlinx_serialization_model_converter/configuration/KotlinxSerializationModelConverterAutoConfiguration.java b/springwolf-add-ons/springwolf-kotlinx-serialization-model-converter/src/main/java/io/github/springwolf/addons/kotlinx_serialization_model_converter/configuration/KotlinxSerializationModelConverterAutoConfiguration.java index a93965944..695588777 100644 --- a/springwolf-add-ons/springwolf-kotlinx-serialization-model-converter/src/main/java/io/github/springwolf/addons/kotlinx_serialization_model_converter/configuration/KotlinxSerializationModelConverterAutoConfiguration.java +++ b/springwolf-add-ons/springwolf-kotlinx-serialization-model-converter/src/main/java/io/github/springwolf/addons/kotlinx_serialization_model_converter/configuration/KotlinxSerializationModelConverterAutoConfiguration.java @@ -2,7 +2,9 @@ package io.github.springwolf.addons.kotlinx_serialization_model_converter.configuration; import io.github.springwolf.addons.kotlinx_serialization_model_converter.converter.KotlinxSerializationModelConverter; -import org.springframework.beans.factory.annotation.Value; +import io.github.springwolf.core.configuration.properties.SpringwolfConfigConstants; +import io.github.springwolf.core.configuration.properties.SpringwolfConfigProperties; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -10,11 +12,11 @@ * Spring AutoConfiguration adding an {@link KotlinxSerializationModelConverter} Bean to the spring context. */ @Configuration(proxyBeanMethods = false) +@ConditionalOnProperty(name = SpringwolfConfigConstants.SPRINGWOLF_ENABLED, havingValue = "true", matchIfMissing = true) public class KotlinxSerializationModelConverterAutoConfiguration { @Bean - public KotlinxSerializationModelConverter kotlinxSerializationTypeConverter( - @Value("${springwolf.use-fqn}") boolean useFqn) { - return new KotlinxSerializationModelConverter(useFqn); + public KotlinxSerializationModelConverter kotlinxSerializationTypeConverter(SpringwolfConfigProperties properties) { + return new KotlinxSerializationModelConverter(properties.isUseFqn()); } } diff --git a/springwolf-core/src/main/java/io/github/springwolf/core/configuration/properties/SpringwolfConfigConstants.java b/springwolf-core/src/main/java/io/github/springwolf/core/configuration/properties/SpringwolfConfigConstants.java index bb6068b77..19b285468 100644 --- a/springwolf-core/src/main/java/io/github/springwolf/core/configuration/properties/SpringwolfConfigConstants.java +++ b/springwolf-core/src/main/java/io/github/springwolf/core/configuration/properties/SpringwolfConfigConstants.java @@ -10,6 +10,8 @@ public class SpringwolfConfigConstants { public static final String SPRINGWOLF_ENABLED = SPRINGWOLF_CONFIG_PREFIX + ENABLED; + public static final String SPRINGWOLF_USE_FQN = SPRINGWOLF_CONFIG_PREFIX + ".use-fqn"; + public static final String ENDPOINT_ACTUATOR = ".endpoint.actuator"; public static final String SPRINGWOLF_ENDPOINT_ACTUATOR_ENABLED =