From f569e5a105f4d4c95a370358e9bce32ced5fb7f5 Mon Sep 17 00:00:00 2001 From: Hank CP Date: Tue, 21 Nov 2023 18:33:27 +0800 Subject: [PATCH] #44 import WebProperties --- gradle.properties | 3 ++- .../java/org/laxture/sbp/spring/boot/SpringBootstrap.java | 2 +- .../sbp/spring/boot/SbpWebFluxPatchAutoConfiguration.java | 4 ++++ .../sbp/spring/boot/SbpWebMvcPatchAutoConfiguration.java | 4 +++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 1767790..7a15563 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,8 @@ http_port=8080 sbpVersion=22 -springBootVersion=3.1.1 +springBootVersion=3.1.4 +#springBootVersion=3.1.1 lombokVersion=1.18.26 pf4jVersion=3.8.0 jooqVersion=3.17.7 diff --git a/sbp-core/src/main/java/org/laxture/sbp/spring/boot/SpringBootstrap.java b/sbp-core/src/main/java/org/laxture/sbp/spring/boot/SpringBootstrap.java index 50c83a7..150072d 100644 --- a/sbp-core/src/main/java/org/laxture/sbp/spring/boot/SpringBootstrap.java +++ b/sbp-core/src/main/java/org/laxture/sbp/spring/boot/SpringBootstrap.java @@ -467,7 +467,7 @@ protected boolean importBean(GenericApplicationContext sourceApplicationContext, Class beanClass) { try { Map beans = sourceApplicationContext.getBeansOfType(beanClass); - if (beans.size() == 0) { + if (beans.isEmpty()) { return false; } for (String beanName : beans.keySet()) { diff --git a/sbp-spring-boot-starter/src/main/java/org/laxture/sbp/spring/boot/SbpWebFluxPatchAutoConfiguration.java b/sbp-spring-boot-starter/src/main/java/org/laxture/sbp/spring/boot/SbpWebFluxPatchAutoConfiguration.java index 7e17493..ea9b4ba 100644 --- a/sbp-spring-boot-starter/src/main/java/org/laxture/sbp/spring/boot/SbpWebFluxPatchAutoConfiguration.java +++ b/sbp-spring-boot-starter/src/main/java/org/laxture/sbp/spring/boot/SbpWebFluxPatchAutoConfiguration.java @@ -23,9 +23,12 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; +import org.springframework.boot.autoconfigure.web.WebProperties; import org.springframework.boot.autoconfigure.web.reactive.PluginWebFluxResourceHandlerRegistrationCustomizer; import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration; +import org.springframework.boot.autoconfigure.web.reactive.WebFluxProperties; import org.springframework.boot.autoconfigure.web.reactive.WebFluxRegistrations; +import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerMapping; @@ -40,6 +43,7 @@ @ConditionalOnProperty(prefix = SbpProperties.PREFIX, value = {"enabled"}, havingValue = "true") @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) @AutoConfigureBefore({ WebFluxAutoConfiguration.class }) +@EnableConfigurationProperties({WebProperties.class, WebFluxProperties.class}) public class SbpWebFluxPatchAutoConfiguration { @Bean diff --git a/sbp-spring-boot-starter/src/main/java/org/laxture/sbp/spring/boot/SbpWebMvcPatchAutoConfiguration.java b/sbp-spring-boot-starter/src/main/java/org/laxture/sbp/spring/boot/SbpWebMvcPatchAutoConfiguration.java index 1da526a..893dc0f 100644 --- a/sbp-spring-boot-starter/src/main/java/org/laxture/sbp/spring/boot/SbpWebMvcPatchAutoConfiguration.java +++ b/sbp-spring-boot-starter/src/main/java/org/laxture/sbp/spring/boot/SbpWebMvcPatchAutoConfiguration.java @@ -23,9 +23,11 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; +import org.springframework.boot.autoconfigure.web.WebProperties; import org.springframework.boot.autoconfigure.web.reactive.WebFluxRegistrations; import org.springframework.boot.autoconfigure.web.servlet.PluginResourceHandlerRegistrationCustomizer; import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations; +import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; @@ -42,7 +44,7 @@ @ConditionalOnClass({ PluginManager.class, SpringBootPluginManager.class }) @ConditionalOnProperty(prefix = SbpProperties.PREFIX, value = "enabled", havingValue = "true") @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) - +@EnableConfigurationProperties(WebProperties.class) public class SbpWebMvcPatchAutoConfiguration { @Bean