From 758d56437bd8199ee45f3b1a7db6ba8daed5d99b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=91=A8?= Date: Mon, 4 Dec 2023 11:27:11 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4spring-boot?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=85=8D=E7=BD=AE.=20(#261)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../authorization/dimension/DimensionManager.java | 1 - .../DefaultAuthorizationAutoConfiguration.java | 12 +++--------- .../src/main/resources/META-INF/spring.factories | 3 --- ...work.boot.autoconfigure.AutoConfiguration.imports | 1 + .../AuthorizingHandlerAutoConfiguration.java | 3 ++- .../WebMvcAuthorizingConfiguration.java | 3 ++- ...ork.boot.autoconfigure.AutoConfiguration.imports} | 4 +--- .../oauth2/server/OAuth2ServerAutoConfiguration.java | 6 ++---- .../src/main/resources/META-INF/spring.factories | 3 --- ...work.boot.autoconfigure.AutoConfiguration.imports | 1 + hsweb-commons/hsweb-commons-api/pom.xml | 5 +++++ .../entity/EntityFactoryHolderConfiguration.java | 3 ++- .../src/main/resources/META-INF/spring.factories | 3 --- ...work.boot.autoconfigure.AutoConfiguration.imports | 1 + .../web/crud/configuration/EasyormConfiguration.java | 3 ++- .../configuration/JdbcSqlExecutorConfiguration.java | 3 ++- .../configuration/R2dbcSqlExecutorConfiguration.java | 3 ++- .../web/crud/web/CommonWebFluxConfiguration.java | 3 ++- .../web/crud/web/CommonWebMvcConfiguration.java | 3 ++- .../src/main/resources/META-INF/spring.factories | 7 ------- ...work.boot.autoconfigure.AutoConfiguration.imports | 5 +++++ .../org/hswebframework/web/cache/ReactiveCache.java | 5 +++++ .../ReactiveCacheManagerConfiguration.java | 4 ++-- .../web/cache/supports/CaffeineReactiveCache.java | 4 ++++ .../web/cache/supports/GuavaReactiveCache.java | 10 ++++++++-- .../web/cache/supports/RedisReactiveCache.java | 2 +- .../src/main/resources/META-INF/spring.factories | 3 --- ...work.boot.autoconfigure.AutoConfiguration.imports | 1 + .../web/aop/MethodInterceptorHolder.java | 8 ++------ .../DynamicDataSourceAutoConfiguration.java | 3 ++- .../src/main/resources/META-INF/spring.factories | 3 --- ...work.boot.autoconfigure.AutoConfiguration.imports | 1 + .../jta/AtomikosDataSourceAutoConfiguration.java | 3 ++- .../src/main/resources/META-INF/spring.factories | 4 ---- ...work.boot.autoconfigure.AutoConfiguration.imports | 1 + .../web/DatasourceWebApiAutoConfiguration.java | 3 ++- .../src/main/resources/META-INF/spring.factories | 3 --- ...work.boot.autoconfigure.AutoConfiguration.imports | 1 + .../web/starter/CorsAutoConfiguration.java | 3 ++- .../web/starter/HswebAutoConfiguration.java | 3 ++- .../web/starter/i18n/I18nConfiguration.java | 3 ++- .../jackson/CustomCodecsAutoConfiguration.java | 4 ++-- .../src/main/resources/META-INF/spring.factories | 6 ------ ...work.boot.autoconfigure.AutoConfiguration.imports | 4 ++++ .../AuthorizationServiceAutoConfiguration.java | 5 +++-- .../AuthorizationWebAutoConfiguration.java | 5 +++-- .../src/main/resources/META-INF/spring.factories | 4 ---- ...work.boot.autoconfigure.AutoConfiguration.imports | 4 ++++ .../OAuth2ClientManagerAutoConfiguration.java | 5 +++-- .../src/main/resources/META-INF/spring.factories | 3 --- ...work.boot.autoconfigure.AutoConfiguration.imports | 2 ++ .../configuration/DictionaryAutoConfiguration.java | 3 ++- .../src/main/resources/META-INF/spring.factories | 3 --- ...work.boot.autoconfigure.AutoConfiguration.imports | 1 + .../web/file/FileServiceConfiguration.java | 3 ++- .../src/main/resources/META-INF/spring.factories | 3 --- ...work.boot.autoconfigure.AutoConfiguration.imports | 1 + pom.xml | 5 ++++- 58 files changed, 104 insertions(+), 101 deletions(-) delete mode 100644 hsweb-authorization/hsweb-authorization-api/src/main/resources/META-INF/spring.factories create mode 100644 hsweb-authorization/hsweb-authorization-api/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports rename hsweb-authorization/hsweb-authorization-basic/src/main/resources/META-INF/{spring.factories => spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports} (57%) delete mode 100644 hsweb-authorization/hsweb-authorization-oauth2/src/main/resources/META-INF/spring.factories create mode 100644 hsweb-authorization/hsweb-authorization-oauth2/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 hsweb-commons/hsweb-commons-api/src/main/resources/META-INF/spring.factories create mode 100644 hsweb-commons/hsweb-commons-api/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 hsweb-commons/hsweb-commons-crud/src/main/resources/META-INF/spring.factories create mode 100644 hsweb-commons/hsweb-commons-crud/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 hsweb-concurrent/hsweb-concurrent-cache/src/main/resources/META-INF/spring.factories create mode 100644 hsweb-concurrent/hsweb-concurrent-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 hsweb-datasource/hsweb-datasource-api/src/main/resources/META-INF/spring.factories create mode 100644 hsweb-datasource/hsweb-datasource-api/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 hsweb-datasource/hsweb-datasource-jta/src/main/resources/META-INF/spring.factories create mode 100644 hsweb-datasource/hsweb-datasource-jta/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 hsweb-datasource/hsweb-datasource-web/src/main/resources/META-INF/spring.factories create mode 100644 hsweb-datasource/hsweb-datasource-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 hsweb-starter/src/main/resources/META-INF/spring.factories create mode 100644 hsweb-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/resources/META-INF/spring.factories create mode 100644 hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/src/main/resources/META-INF/spring.factories create mode 100644 hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 hsweb-system/hsweb-system-dictionary/src/main/resources/META-INF/spring.factories create mode 100644 hsweb-system/hsweb-system-dictionary/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 hsweb-system/hsweb-system-file/src/main/resources/META-INF/spring.factories create mode 100644 hsweb-system/hsweb-system-file/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/dimension/DimensionManager.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/dimension/DimensionManager.java index 5837635db..ccb56a2e5 100644 --- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/dimension/DimensionManager.java +++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/dimension/DimensionManager.java @@ -15,7 +15,6 @@ public interface DimensionManager { /** * 获取用户维度 * - * @param type 维度类型 * @param userId 用户ID * @return 用户维度信息 */ diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/simple/DefaultAuthorizationAutoConfiguration.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/simple/DefaultAuthorizationAutoConfiguration.java index 66fadf24e..704980582 100644 --- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/simple/DefaultAuthorizationAutoConfiguration.java +++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/simple/DefaultAuthorizationAutoConfiguration.java @@ -14,6 +14,7 @@ import org.hswebframework.web.authorization.twofactor.defaults.DefaultTwoFactorV import org.hswebframework.web.convert.CustomMessageConverter; import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -25,12 +26,9 @@ import java.util.List; /** * @author zhouhao */ -@Configuration +@AutoConfiguration public class DefaultAuthorizationAutoConfiguration { - @Autowired(required = false) - private List dataAccessConfigConverters; - @Bean @ConditionalOnMissingBean(UserTokenManager.class) @ConfigurationProperties(prefix = "hsweb.user-token") @@ -67,11 +65,7 @@ public class DefaultAuthorizationAutoConfiguration { @ConditionalOnMissingBean(DataAccessConfigBuilderFactory.class) @ConfigurationProperties(prefix = "hsweb.authorization.data-access", ignoreInvalidFields = true) public SimpleDataAccessConfigBuilderFactory dataAccessConfigBuilderFactory() { - SimpleDataAccessConfigBuilderFactory factory = new SimpleDataAccessConfigBuilderFactory(); - if (null != dataAccessConfigConverters) { - dataAccessConfigConverters.forEach(factory::addConvert); - } - return factory; + return new SimpleDataAccessConfigBuilderFactory(); } @Bean diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/resources/META-INF/spring.factories b/hsweb-authorization/hsweb-authorization-api/src/main/resources/META-INF/spring.factories deleted file mode 100644 index cb2dcecb0..000000000 --- a/hsweb-authorization/hsweb-authorization-api/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,3 +0,0 @@ -# Auto Configure -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.hswebframework.web.authorization.simple.DefaultAuthorizationAutoConfiguration \ No newline at end of file diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hsweb-authorization/hsweb-authorization-api/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..1afa66b8e --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-api/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.hswebframework.web.authorization.simple.DefaultAuthorizationAutoConfiguration \ No newline at end of file diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/AuthorizingHandlerAutoConfiguration.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/AuthorizingHandlerAutoConfiguration.java index e542d8c63..18f1928d3 100644 --- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/AuthorizingHandlerAutoConfiguration.java +++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/AuthorizingHandlerAutoConfiguration.java @@ -16,6 +16,7 @@ import org.hswebframework.web.authorization.token.UserTokenManager; import org.hswebframework.web.authorization.twofactor.TwoFactorValidatorManager; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.*; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; @@ -36,7 +37,7 @@ import java.util.List; * @author zhouhao * @since 3.0 */ -@Configuration +@AutoConfiguration @EnableConfigurationProperties(EmbedAuthenticationProperties.class) public class AuthorizingHandlerAutoConfiguration { diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/WebMvcAuthorizingConfiguration.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/WebMvcAuthorizingConfiguration.java index e7b97facc..7ff7373e0 100644 --- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/WebMvcAuthorizingConfiguration.java +++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/configuration/WebMvcAuthorizingConfiguration.java @@ -5,6 +5,7 @@ import org.hswebframework.web.authorization.basic.twofactor.TwoFactorHandlerInte import org.hswebframework.web.authorization.basic.web.*; import org.hswebframework.web.authorization.token.UserTokenManager; import org.hswebframework.web.authorization.twofactor.TwoFactorValidatorManager; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.*; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; @@ -17,7 +18,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import javax.annotation.Nonnull; import java.util.List; -@Configuration +@AutoConfiguration @ConditionalOnClass(name = "org.springframework.web.servlet.config.annotation.WebMvcConfigurer") @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) public class WebMvcAuthorizingConfiguration { diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/resources/META-INF/spring.factories b/hsweb-authorization/hsweb-authorization-basic/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports similarity index 57% rename from hsweb-authorization/hsweb-authorization-basic/src/main/resources/META-INF/spring.factories rename to hsweb-authorization/hsweb-authorization-basic/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index e8d9b2d64..42849de36 100644 --- a/hsweb-authorization/hsweb-authorization-basic/src/main/resources/META-INF/spring.factories +++ b/hsweb-authorization/hsweb-authorization-basic/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,4 +1,2 @@ -# Auto Configure -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.hswebframework.web.authorization.basic.configuration.AuthorizingHandlerAutoConfiguration,\ +org.hswebframework.web.authorization.basic.configuration.AuthorizingHandlerAutoConfiguration org.hswebframework.web.authorization.basic.configuration.WebMvcAuthorizingConfiguration \ No newline at end of file diff --git a/hsweb-authorization/hsweb-authorization-oauth2/src/main/java/org/hswebframework/web/oauth2/server/OAuth2ServerAutoConfiguration.java b/hsweb-authorization/hsweb-authorization-oauth2/src/main/java/org/hswebframework/web/oauth2/server/OAuth2ServerAutoConfiguration.java index 42f1a575c..4fdfa28e0 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/src/main/java/org/hswebframework/web/oauth2/server/OAuth2ServerAutoConfiguration.java +++ b/hsweb-authorization/hsweb-authorization-oauth2/src/main/java/org/hswebframework/web/oauth2/server/OAuth2ServerAutoConfiguration.java @@ -1,11 +1,8 @@ package org.hswebframework.web.oauth2.server; -import org.hswebframework.web.authorization.ReactiveAuthenticationHolder; import org.hswebframework.web.authorization.ReactiveAuthenticationManager; import org.hswebframework.web.authorization.basic.web.ReactiveUserTokenParser; -import org.hswebframework.web.authorization.token.UserToken; import org.hswebframework.web.authorization.token.UserTokenManager; -import org.hswebframework.web.oauth2.server.auth.ReactiveOAuth2AccessTokenParser; import org.hswebframework.web.oauth2.server.code.AuthorizationCodeGranter; import org.hswebframework.web.oauth2.server.code.DefaultAuthorizationCodeGranter; import org.hswebframework.web.oauth2.server.credential.ClientCredentialGranter; @@ -16,6 +13,7 @@ import org.hswebframework.web.oauth2.server.refresh.DefaultRefreshTokenGranter; import org.hswebframework.web.oauth2.server.refresh.RefreshTokenGranter; import org.hswebframework.web.oauth2.server.web.OAuth2AuthorizeController; import org.springframework.beans.factory.ObjectProvider; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -27,7 +25,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory; import org.springframework.data.redis.core.ReactiveRedisOperations; -@Configuration(proxyBeanMethods = false) +@AutoConfiguration @EnableConfigurationProperties(OAuth2Properties.class) public class OAuth2ServerAutoConfiguration { diff --git a/hsweb-authorization/hsweb-authorization-oauth2/src/main/resources/META-INF/spring.factories b/hsweb-authorization/hsweb-authorization-oauth2/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 8e76d8af6..000000000 --- a/hsweb-authorization/hsweb-authorization-oauth2/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,3 +0,0 @@ -# Auto Configure -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.hswebframework.web.oauth2.server.OAuth2ServerAutoConfiguration \ No newline at end of file diff --git a/hsweb-authorization/hsweb-authorization-oauth2/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hsweb-authorization/hsweb-authorization-oauth2/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..42c207559 --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-oauth2/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.hswebframework.web.oauth2.server.OAuth2ServerAutoConfiguration \ No newline at end of file diff --git a/hsweb-commons/hsweb-commons-api/pom.xml b/hsweb-commons/hsweb-commons-api/pom.xml index 110b8c5c2..a63d83832 100644 --- a/hsweb-commons/hsweb-commons-api/pom.xml +++ b/hsweb-commons/hsweb-commons-api/pom.xml @@ -49,6 +49,11 @@ commons-codec + + org.springframework.boot + spring-boot-autoconfigure + + \ No newline at end of file diff --git a/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/EntityFactoryHolderConfiguration.java b/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/EntityFactoryHolderConfiguration.java index 84074bfcc..a39b2e534 100644 --- a/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/EntityFactoryHolderConfiguration.java +++ b/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/EntityFactoryHolderConfiguration.java @@ -1,11 +1,12 @@ package org.hswebframework.web.api.crud.entity; import org.springframework.beans.BeansException; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.context.ApplicationContextAware; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -@Configuration(proxyBeanMethods = false) +@AutoConfiguration public class EntityFactoryHolderConfiguration { diff --git a/hsweb-commons/hsweb-commons-api/src/main/resources/META-INF/spring.factories b/hsweb-commons/hsweb-commons-api/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 90971163a..000000000 --- a/hsweb-commons/hsweb-commons-api/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,3 +0,0 @@ -# Auto Configure -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.hswebframework.web.api.crud.entity.EntityFactoryHolderConfiguration \ No newline at end of file diff --git a/hsweb-commons/hsweb-commons-api/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hsweb-commons/hsweb-commons-api/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..8e62f1085 --- /dev/null +++ b/hsweb-commons/hsweb-commons-api/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.hswebframework.web.api.crud.entity.EntityFactoryHolderConfiguration \ No newline at end of file diff --git a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EasyormConfiguration.java b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EasyormConfiguration.java index 4dc32b3e8..dca1996c8 100644 --- a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EasyormConfiguration.java +++ b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/EasyormConfiguration.java @@ -35,6 +35,7 @@ import org.springframework.beans.BeansException; import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -53,7 +54,7 @@ import java.util.List; import java.util.Optional; import java.util.Set; -@Configuration +@AutoConfiguration @EnableConfigurationProperties(EasyormProperties.class) @EnableEasyormRepository("org.hswebframework.web.**.entity") public class EasyormConfiguration { diff --git a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/JdbcSqlExecutorConfiguration.java b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/JdbcSqlExecutorConfiguration.java index 3205e05dc..f7ebe67bd 100644 --- a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/JdbcSqlExecutorConfiguration.java +++ b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/JdbcSqlExecutorConfiguration.java @@ -4,6 +4,7 @@ import org.hswebframework.ezorm.rdb.executor.SyncSqlExecutor; import org.hswebframework.ezorm.rdb.executor.reactive.ReactiveSqlExecutor; import org.hswebframework.web.crud.sql.DefaultJdbcExecutor; import org.hswebframework.web.crud.sql.DefaultJdbcReactiveExecutor; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -13,7 +14,7 @@ import org.springframework.context.annotation.Configuration; import javax.sql.DataSource; -@Configuration +@AutoConfiguration @AutoConfigureAfter(DataSourceAutoConfiguration.class) @ConditionalOnBean(DataSource.class) public class JdbcSqlExecutorConfiguration { diff --git a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/R2dbcSqlExecutorConfiguration.java b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/R2dbcSqlExecutorConfiguration.java index 5275b6075..a317a7a3c 100644 --- a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/R2dbcSqlExecutorConfiguration.java +++ b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/configuration/R2dbcSqlExecutorConfiguration.java @@ -5,6 +5,7 @@ import org.hswebframework.ezorm.rdb.executor.SyncSqlExecutor; import org.hswebframework.ezorm.rdb.executor.reactive.ReactiveSqlExecutor; import org.hswebframework.ezorm.rdb.executor.reactive.ReactiveSyncSqlExecutor; import org.hswebframework.web.crud.sql.DefaultR2dbcExecutor; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -12,7 +13,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -@Configuration +@AutoConfiguration @AutoConfigureAfter(name = "org.springframework.boot.autoconfigure.r2dbc.R2dbcAutoConfiguration") @ConditionalOnBean(ConnectionFactory.class) public class R2dbcSqlExecutorConfiguration { diff --git a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/CommonWebFluxConfiguration.java b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/CommonWebFluxConfiguration.java index bcbdd9c84..562cef16a 100644 --- a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/CommonWebFluxConfiguration.java +++ b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/CommonWebFluxConfiguration.java @@ -1,6 +1,7 @@ package org.hswebframework.web.crud.web; import org.hswebframework.web.i18n.WebFluxLocaleFilter; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -13,7 +14,7 @@ import org.springframework.http.codec.ServerCodecConfigurer; import org.springframework.web.reactive.accept.RequestedContentTypeResolver; import org.springframework.web.server.WebFilter; -@Configuration +@AutoConfiguration @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) public class CommonWebFluxConfiguration { diff --git a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/CommonWebMvcConfiguration.java b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/CommonWebMvcConfiguration.java index cb72e93e4..7268e4f67 100644 --- a/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/CommonWebMvcConfiguration.java +++ b/hsweb-commons/hsweb-commons-crud/src/main/java/org/hswebframework/web/crud/web/CommonWebMvcConfiguration.java @@ -1,5 +1,6 @@ package org.hswebframework.web.crud.web; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -8,7 +9,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -@Configuration +@AutoConfiguration @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnClass(org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice.class) public class CommonWebMvcConfiguration { diff --git a/hsweb-commons/hsweb-commons-crud/src/main/resources/META-INF/spring.factories b/hsweb-commons/hsweb-commons-crud/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 0fe7a61e4..000000000 --- a/hsweb-commons/hsweb-commons-crud/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,7 +0,0 @@ -# Auto Configure -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.hswebframework.web.crud.configuration.EasyormConfiguration,\ -org.hswebframework.web.crud.configuration.JdbcSqlExecutorConfiguration,\ -org.hswebframework.web.crud.configuration.R2dbcSqlExecutorConfiguration,\ -org.hswebframework.web.crud.web.CommonWebFluxConfiguration,\ -org.hswebframework.web.crud.web.CommonWebMvcConfiguration \ No newline at end of file diff --git a/hsweb-commons/hsweb-commons-crud/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hsweb-commons/hsweb-commons-crud/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..b54296e48 --- /dev/null +++ b/hsweb-commons/hsweb-commons-crud/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,5 @@ +org.hswebframework.web.crud.configuration.EasyormConfiguration +org.hswebframework.web.crud.configuration.JdbcSqlExecutorConfiguration +org.hswebframework.web.crud.configuration.R2dbcSqlExecutorConfiguration +org.hswebframework.web.crud.web.CommonWebFluxConfiguration +org.hswebframework.web.crud.web.CommonWebMvcConfiguration \ No newline at end of file diff --git a/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/ReactiveCache.java b/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/ReactiveCache.java index 35b087224..dafa7b648 100644 --- a/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/ReactiveCache.java +++ b/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/ReactiveCache.java @@ -10,6 +10,11 @@ import java.util.Collection; import java.util.function.Function; import java.util.function.Supplier; +/** + * 响应式缓存 + * + * @param 缓存元素类型 + */ public interface ReactiveCache { Flux getFlux(Object key); diff --git a/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/configuration/ReactiveCacheManagerConfiguration.java b/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/configuration/ReactiveCacheManagerConfiguration.java index a8256a9d5..5b764fa74 100644 --- a/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/configuration/ReactiveCacheManagerConfiguration.java +++ b/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/configuration/ReactiveCacheManagerConfiguration.java @@ -1,13 +1,13 @@ package org.hswebframework.web.cache.configuration; import org.hswebframework.web.cache.ReactiveCacheManager; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -@Configuration +@AutoConfiguration @ConditionalOnMissingBean(ReactiveCacheManager.class) @EnableConfigurationProperties(ReactiveCacheProperties.class) public class ReactiveCacheManagerConfiguration { diff --git a/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/supports/CaffeineReactiveCache.java b/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/supports/CaffeineReactiveCache.java index 8acbb1eca..84b425213 100644 --- a/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/supports/CaffeineReactiveCache.java +++ b/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/supports/CaffeineReactiveCache.java @@ -24,6 +24,10 @@ public class CaffeineReactiveCache extends AbstractReactiveCache { @Override public Flux getAll(Object... keys) { return Flux.defer(() -> { + if (keys == null || keys.length == 0) { + return Flux.fromIterable(cache.asMap().values()) + .map(e -> (E) e); + } return Flux.fromIterable(cache.getAllPresent(Arrays.asList(keys)).values()) .map(e -> (E) e); }); diff --git a/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/supports/GuavaReactiveCache.java b/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/supports/GuavaReactiveCache.java index 3fd0591ef..fa4245283 100644 --- a/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/supports/GuavaReactiveCache.java +++ b/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/supports/GuavaReactiveCache.java @@ -9,7 +9,7 @@ import java.util.Arrays; @SuppressWarnings("all") @AllArgsConstructor -public class GuavaReactiveCache extends AbstractReactiveCache{ +public class GuavaReactiveCache extends AbstractReactiveCache { private Cache cache; @@ -34,11 +34,17 @@ public class GuavaReactiveCache extends AbstractReactiveCache{ public Mono evict(Object key) { return Mono.fromRunnable(() -> cache.invalidate(key)); } + @Override public Flux getAll(Object... keys) { return Flux.defer(() -> { + if (keys == null || keys.length == 0) { + return Flux + .fromIterable(cache.asMap().values()) + .map(e -> (E) e); + } return Flux.fromIterable(cache.getAllPresent(Arrays.asList(keys)).values()) - .map(e -> (E) e); + .map(e -> (E) e); }); } diff --git a/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/supports/RedisReactiveCache.java b/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/supports/RedisReactiveCache.java index 7a5836418..c72c4dda0 100644 --- a/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/supports/RedisReactiveCache.java +++ b/hsweb-concurrent/hsweb-concurrent-cache/src/main/java/org/hswebframework/web/cache/supports/RedisReactiveCache.java @@ -80,7 +80,7 @@ public class RedisReactiveCache extends AbstractReactiveCache { @Override public Flux getAll(Object... keys) { - if (keys.length == 0) { + if (keys == null || keys.length == 0) { return operations .opsForHash() .values(redisKey) diff --git a/hsweb-concurrent/hsweb-concurrent-cache/src/main/resources/META-INF/spring.factories b/hsweb-concurrent/hsweb-concurrent-cache/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 0fd0e2620..000000000 --- a/hsweb-concurrent/hsweb-concurrent-cache/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,3 +0,0 @@ -# Auto Configure -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.hswebframework.web.cache.configuration.ReactiveCacheManagerConfiguration \ No newline at end of file diff --git a/hsweb-concurrent/hsweb-concurrent-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hsweb-concurrent/hsweb-concurrent-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..459a3e025 --- /dev/null +++ b/hsweb-concurrent/hsweb-concurrent-cache/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.hswebframework.web.cache.configuration.ReactiveCacheManagerConfiguration \ No newline at end of file diff --git a/hsweb-core/src/main/java/org/hswebframework/web/aop/MethodInterceptorHolder.java b/hsweb-core/src/main/java/org/hswebframework/web/aop/MethodInterceptorHolder.java index 57b1b0304..184775977 100644 --- a/hsweb-core/src/main/java/org/hswebframework/web/aop/MethodInterceptorHolder.java +++ b/hsweb-core/src/main/java/org/hswebframework/web/aop/MethodInterceptorHolder.java @@ -21,19 +21,15 @@ package org.hswebframework.web.aop; import com.google.common.collect.Maps; import lombok.AllArgsConstructor; import lombok.Getter; -import lombok.Setter; import org.aopalliance.intercept.MethodInvocation; import org.hswebframework.web.utils.AnnotationUtils; import org.hswebframework.web.utils.DigestUtils; import org.reactivestreams.Publisher; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; +import org.springframework.core.DefaultParameterNameDiscoverer; import org.springframework.core.ParameterNameDiscoverer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; import java.lang.annotation.Annotation; import java.lang.reflect.Method; -import java.util.LinkedHashMap; import java.util.Map; import java.util.Optional; import java.util.function.Function; @@ -47,7 +43,7 @@ public class MethodInterceptorHolder { /** * 参数名称获取器,用于获取方法参数的名称 */ - public static final ParameterNameDiscoverer nameDiscoverer = new LocalVariableTableParameterNameDiscoverer(); + public static final ParameterNameDiscoverer nameDiscoverer = new DefaultParameterNameDiscoverer(); public static MethodInterceptorHolder create(MethodInvocation invocation) { String[] argNames = nameDiscoverer.getParameterNames(invocation.getMethod()); diff --git a/hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/DynamicDataSourceAutoConfiguration.java b/hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/DynamicDataSourceAutoConfiguration.java index acdac629b..f95973c48 100644 --- a/hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/DynamicDataSourceAutoConfiguration.java +++ b/hsweb-datasource/hsweb-datasource-api/src/main/java/org/hswebframework/web/datasource/DynamicDataSourceAutoConfiguration.java @@ -3,6 +3,7 @@ package org.hswebframework.web.datasource; import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; @@ -11,7 +12,7 @@ import org.springframework.context.annotation.Configuration; /** * @author zhouhao */ -@Configuration +@AutoConfiguration @ImportAutoConfiguration(AopDataSourceSwitcherAutoConfiguration.class) public class DynamicDataSourceAutoConfiguration { diff --git a/hsweb-datasource/hsweb-datasource-api/src/main/resources/META-INF/spring.factories b/hsweb-datasource/hsweb-datasource-api/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 2e3dfc8b4..000000000 --- a/hsweb-datasource/hsweb-datasource-api/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,3 +0,0 @@ -# Auto Configure -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.hswebframework.web.datasource.DynamicDataSourceAutoConfiguration \ No newline at end of file diff --git a/hsweb-datasource/hsweb-datasource-api/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hsweb-datasource/hsweb-datasource-api/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..bc57e3d89 --- /dev/null +++ b/hsweb-datasource/hsweb-datasource-api/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.hswebframework.web.datasource.DynamicDataSourceAutoConfiguration \ No newline at end of file diff --git a/hsweb-datasource/hsweb-datasource-jta/src/main/java/org/hswebframework/web/datasource/jta/AtomikosDataSourceAutoConfiguration.java b/hsweb-datasource/hsweb-datasource-jta/src/main/java/org/hswebframework/web/datasource/jta/AtomikosDataSourceAutoConfiguration.java index 15b29ee84..7c904097d 100644 --- a/hsweb-datasource/hsweb-datasource-jta/src/main/java/org/hswebframework/web/datasource/jta/AtomikosDataSourceAutoConfiguration.java +++ b/hsweb-datasource/hsweb-datasource-jta/src/main/java/org/hswebframework/web/datasource/jta/AtomikosDataSourceAutoConfiguration.java @@ -3,6 +3,7 @@ package org.hswebframework.web.datasource.jta; import org.hswebframework.web.datasource.DynamicDataSourceAutoConfiguration; import org.hswebframework.web.datasource.DynamicDataSourceService; import org.hswebframework.web.datasource.config.DynamicDataSourceConfigRepository; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.jta.atomikos.AtomikosDataSourceBean; @@ -16,7 +17,7 @@ import java.sql.SQLException; /** * @author zhouhao */ -@Configuration +@AutoConfiguration @AutoConfigureBefore(DynamicDataSourceAutoConfiguration.class) public class AtomikosDataSourceAutoConfiguration { diff --git a/hsweb-datasource/hsweb-datasource-jta/src/main/resources/META-INF/spring.factories b/hsweb-datasource/hsweb-datasource-jta/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 23ff1b58d..000000000 --- a/hsweb-datasource/hsweb-datasource-jta/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,4 +0,0 @@ -# Auto Configure -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.hswebframework.web.datasource.jta.AtomikosDataSourceAutoConfiguration,\ -org.hswebframework.web.datasource.jta.JtaJdbcSqlExecutorAutoConfiguration \ No newline at end of file diff --git a/hsweb-datasource/hsweb-datasource-jta/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hsweb-datasource/hsweb-datasource-jta/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..c8c233c38 --- /dev/null +++ b/hsweb-datasource/hsweb-datasource-jta/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.hswebframework.web.datasource.jta.AtomikosDataSourceAutoConfiguration \ No newline at end of file diff --git a/hsweb-datasource/hsweb-datasource-web/src/main/java/org/hswebframework/web/datasource/web/DatasourceWebApiAutoConfiguration.java b/hsweb-datasource/hsweb-datasource-web/src/main/java/org/hswebframework/web/datasource/web/DatasourceWebApiAutoConfiguration.java index 9f8d899f7..633aa79bf 100644 --- a/hsweb-datasource/hsweb-datasource-web/src/main/java/org/hswebframework/web/datasource/web/DatasourceWebApiAutoConfiguration.java +++ b/hsweb-datasource/hsweb-datasource-web/src/main/java/org/hswebframework/web/datasource/web/DatasourceWebApiAutoConfiguration.java @@ -1,9 +1,10 @@ package org.hswebframework.web.datasource.web; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -@Configuration +@AutoConfiguration public class DatasourceWebApiAutoConfiguration { @Bean diff --git a/hsweb-datasource/hsweb-datasource-web/src/main/resources/META-INF/spring.factories b/hsweb-datasource/hsweb-datasource-web/src/main/resources/META-INF/spring.factories deleted file mode 100644 index b72459b53..000000000 --- a/hsweb-datasource/hsweb-datasource-web/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,3 +0,0 @@ -# Auto Configure -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.hswebframework.web.datasource.web.DatasourceWebApiAutoConfiguration \ No newline at end of file diff --git a/hsweb-datasource/hsweb-datasource-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hsweb-datasource/hsweb-datasource-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..66b9b289b --- /dev/null +++ b/hsweb-datasource/hsweb-datasource-web/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.hswebframework.web.datasource.web.DatasourceWebApiAutoConfiguration \ No newline at end of file diff --git a/hsweb-starter/src/main/java/org/hswebframework/web/starter/CorsAutoConfiguration.java b/hsweb-starter/src/main/java/org/hswebframework/web/starter/CorsAutoConfiguration.java index f0a9fa45c..dcac2c1cb 100644 --- a/hsweb-starter/src/main/java/org/hswebframework/web/starter/CorsAutoConfiguration.java +++ b/hsweb-starter/src/main/java/org/hswebframework/web/starter/CorsAutoConfiguration.java @@ -1,5 +1,6 @@ package org.hswebframework.web.starter; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; @@ -61,7 +62,7 @@ import java.util.Optional; * @author Jia * @since 1.0 */ -@Configuration +@AutoConfiguration @ConditionalOnProperty(prefix = "hsweb.cors", name = "enable", havingValue = "true") @EnableConfigurationProperties(CorsProperties.class) public class CorsAutoConfiguration { diff --git a/hsweb-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java b/hsweb-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java index f78873797..add60606d 100644 --- a/hsweb-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java +++ b/hsweb-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java @@ -12,6 +12,7 @@ import org.hswebframework.web.starter.initialize.SystemVersion; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; @@ -24,7 +25,7 @@ import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.Stream; -@Configuration +@AutoConfiguration @EnableConfigurationProperties(AppProperties.class) public class HswebAutoConfiguration { diff --git a/hsweb-starter/src/main/java/org/hswebframework/web/starter/i18n/I18nConfiguration.java b/hsweb-starter/src/main/java/org/hswebframework/web/starter/i18n/I18nConfiguration.java index 419efd887..6b888f12f 100644 --- a/hsweb-starter/src/main/java/org/hswebframework/web/starter/i18n/I18nConfiguration.java +++ b/hsweb-starter/src/main/java/org/hswebframework/web/starter/i18n/I18nConfiguration.java @@ -4,6 +4,7 @@ import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.hswebframework.web.i18n.MessageSourceInitializer; import org.springframework.beans.factory.ObjectProvider; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigureOrder; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; @@ -18,7 +19,7 @@ import org.springframework.util.StringUtils; import java.util.Arrays; import java.util.stream.Collectors; -@Configuration(proxyBeanMethods = false) +@AutoConfiguration @AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE) @Slf4j public class I18nConfiguration { diff --git a/hsweb-starter/src/main/java/org/hswebframework/web/starter/jackson/CustomCodecsAutoConfiguration.java b/hsweb-starter/src/main/java/org/hswebframework/web/starter/jackson/CustomCodecsAutoConfiguration.java index 056454b0d..ef813bc2c 100644 --- a/hsweb-starter/src/main/java/org/hswebframework/web/starter/jackson/CustomCodecsAutoConfiguration.java +++ b/hsweb-starter/src/main/java/org/hswebframework/web/starter/jackson/CustomCodecsAutoConfiguration.java @@ -11,6 +11,7 @@ import com.fasterxml.jackson.databind.type.ClassKey; import com.fasterxml.jackson.databind.type.ReferenceType; import org.hswebframework.web.api.crud.entity.EntityFactory; import org.hswebframework.web.dict.EnumDict; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -23,8 +24,7 @@ import org.springframework.http.codec.CodecConfigurer; import java.io.IOException; -@Configuration(proxyBeanMethods = false) -@AutoConfigureAfter(JacksonAutoConfiguration.class) +@AutoConfiguration(after = JacksonAutoConfiguration.class) public class CustomCodecsAutoConfiguration { @Configuration(proxyBeanMethods = false) diff --git a/hsweb-starter/src/main/resources/META-INF/spring.factories b/hsweb-starter/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 43f2e42db..000000000 --- a/hsweb-starter/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,6 +0,0 @@ -# Auto Configure -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.hswebframework.web.starter.jackson.CustomCodecsAutoConfiguration,\ -org.hswebframework.web.starter.HswebAutoConfiguration,\ -org.hswebframework.web.starter.CorsAutoConfiguration,\ -org.hswebframework.web.starter.i18n.I18nConfiguration \ No newline at end of file diff --git a/hsweb-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hsweb-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..69890fd2e --- /dev/null +++ b/hsweb-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,4 @@ +org.hswebframework.web.starter.jackson.CustomCodecsAutoConfiguration +org.hswebframework.web.starter.HswebAutoConfiguration +org.hswebframework.web.starter.CorsAutoConfiguration +org.hswebframework.web.starter.i18n.I18nConfiguration \ No newline at end of file diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/configuration/AuthorizationServiceAutoConfiguration.java b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/configuration/AuthorizationServiceAutoConfiguration.java index 165051d97..49f0d035c 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/configuration/AuthorizationServiceAutoConfiguration.java +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/configuration/AuthorizationServiceAutoConfiguration.java @@ -14,6 +14,7 @@ import org.hswebframework.web.system.authorization.defaults.service.*; import org.hswebframework.web.system.authorization.defaults.service.terms.DimensionTerm; import org.hswebframework.web.system.authorization.defaults.service.terms.UserDimensionTerm; import org.springframework.beans.factory.ObjectProvider; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -21,10 +22,10 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -@Configuration +@AutoConfiguration public class AuthorizationServiceAutoConfiguration { - @Configuration(proxyBeanMethods = false) + @AutoConfiguration @AutoConfigureBefore(DefaultAuthorizationAutoConfiguration.class) static class ReactiveAuthorizationServiceAutoConfiguration { @ConditionalOnBean(ReactiveRepository.class) diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/configuration/AuthorizationWebAutoConfiguration.java b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/configuration/AuthorizationWebAutoConfiguration.java index 1a41ee25f..7b3a3fddc 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/configuration/AuthorizationWebAutoConfiguration.java +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/java/org/hswebframework/web/system/authorization/defaults/configuration/AuthorizationWebAutoConfiguration.java @@ -1,17 +1,18 @@ package org.hswebframework.web.system.authorization.defaults.configuration; import org.hswebframework.web.system.authorization.defaults.webflux.*; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -@Configuration +@AutoConfiguration public class AuthorizationWebAutoConfiguration { - @Configuration(proxyBeanMethods = false) + @AutoConfiguration @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) public static class WebFluxAuthorizationConfiguration { diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/resources/META-INF/spring.factories b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 67134b550..000000000 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,4 +0,0 @@ -# Auto Configure -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.hswebframework.web.system.authorization.defaults.configuration.AuthorizationServiceAutoConfiguration,\ -org.hswebframework.web.system.authorization.defaults.configuration.AuthorizationWebAutoConfiguration \ No newline at end of file diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..554ed7245 --- /dev/null +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-default/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,4 @@ +org.hswebframework.web.system.authorization.defaults.configuration.AuthorizationServiceAutoConfiguration +org.hswebframework.web.system.authorization.defaults.configuration.AuthorizationServiceAutoConfiguration.ReactiveAuthorizationServiceAutoConfiguration +org.hswebframework.web.system.authorization.defaults.configuration.AuthorizationWebAutoConfiguration +org.hswebframework.web.system.authorization.defaults.configuration.AuthorizationWebAutoConfiguration.WebFluxAuthorizationConfiguration \ No newline at end of file diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/src/main/java/org/hswebframework/web/oauth2/configuration/OAuth2ClientManagerAutoConfiguration.java b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/src/main/java/org/hswebframework/web/oauth2/configuration/OAuth2ClientManagerAutoConfiguration.java index c9121c58f..b0a81c2f0 100644 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/src/main/java/org/hswebframework/web/oauth2/configuration/OAuth2ClientManagerAutoConfiguration.java +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/src/main/java/org/hswebframework/web/oauth2/configuration/OAuth2ClientManagerAutoConfiguration.java @@ -4,15 +4,16 @@ import org.hswebframework.web.oauth2.server.OAuth2ClientManager; import org.hswebframework.web.oauth2.service.InDBOAuth2ClientManager; import org.hswebframework.web.oauth2.service.OAuth2ClientService; import org.hswebframework.web.oauth2.web.WebFluxOAuth2ClientController; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -@Configuration(proxyBeanMethods = false) +@AutoConfiguration public class OAuth2ClientManagerAutoConfiguration { - @Configuration(proxyBeanMethods = false) + @AutoConfiguration @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) static class ReactiveOAuth2ClientManagerAutoConfiguration { diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/src/main/resources/META-INF/spring.factories b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 4f804d6fb..000000000 --- a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,3 +0,0 @@ -# Auto Configure -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.hswebframework.web.oauth2.configuration.OAuth2ClientManagerAutoConfiguration \ No newline at end of file diff --git a/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..176e89837 --- /dev/null +++ b/hsweb-system/hsweb-system-authorization/hsweb-system-authorization-oauth2/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,2 @@ +org.hswebframework.web.oauth2.configuration.OAuth2ClientManagerAutoConfiguration +org.hswebframework.web.oauth2.configuration.OAuth2ClientManagerAutoConfiguration.ReactiveOAuth2ClientManagerAutoConfiguration \ No newline at end of file diff --git a/hsweb-system/hsweb-system-dictionary/src/main/java/org/hswebframework/web/dictionary/configuration/DictionaryAutoConfiguration.java b/hsweb-system/hsweb-system-dictionary/src/main/java/org/hswebframework/web/dictionary/configuration/DictionaryAutoConfiguration.java index e7ae2b0e6..6b00d9aa4 100644 --- a/hsweb-system/hsweb-system-dictionary/src/main/java/org/hswebframework/web/dictionary/configuration/DictionaryAutoConfiguration.java +++ b/hsweb-system/hsweb-system-dictionary/src/main/java/org/hswebframework/web/dictionary/configuration/DictionaryAutoConfiguration.java @@ -5,12 +5,13 @@ import org.hswebframework.web.dictionary.service.DefaultDictionaryItemService; import org.hswebframework.web.dictionary.service.DefaultDictionaryService; import org.hswebframework.web.dictionary.webflux.WebfluxDictionaryController; import org.hswebframework.web.dictionary.webflux.WebfluxDictionaryItemController; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -@Configuration +@AutoConfiguration @EnableConfigurationProperties(DictionaryProperties.class) public class DictionaryAutoConfiguration { diff --git a/hsweb-system/hsweb-system-dictionary/src/main/resources/META-INF/spring.factories b/hsweb-system/hsweb-system-dictionary/src/main/resources/META-INF/spring.factories deleted file mode 100644 index c50a45022..000000000 --- a/hsweb-system/hsweb-system-dictionary/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,3 +0,0 @@ -# Auto Configure -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.hswebframework.web.dictionary.configuration.DictionaryAutoConfiguration \ No newline at end of file diff --git a/hsweb-system/hsweb-system-dictionary/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hsweb-system/hsweb-system-dictionary/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..231733ee0 --- /dev/null +++ b/hsweb-system/hsweb-system-dictionary/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.hswebframework.web.dictionary.configuration.DictionaryAutoConfiguration \ No newline at end of file diff --git a/hsweb-system/hsweb-system-file/src/main/java/org/hswebframework/web/file/FileServiceConfiguration.java b/hsweb-system/hsweb-system-file/src/main/java/org/hswebframework/web/file/FileServiceConfiguration.java index ab1b0085a..082c8cf86 100644 --- a/hsweb-system/hsweb-system-file/src/main/java/org/hswebframework/web/file/FileServiceConfiguration.java +++ b/hsweb-system/hsweb-system-file/src/main/java/org/hswebframework/web/file/FileServiceConfiguration.java @@ -3,13 +3,14 @@ package org.hswebframework.web.file; import org.hswebframework.web.file.service.FileStorageService; import org.hswebframework.web.file.service.LocalFileStorageService; import org.hswebframework.web.file.web.ReactiveFileController; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -@Configuration +@AutoConfiguration @EnableConfigurationProperties(FileUploadProperties.class) public class FileServiceConfiguration { diff --git a/hsweb-system/hsweb-system-file/src/main/resources/META-INF/spring.factories b/hsweb-system/hsweb-system-file/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 98aeb609e..000000000 --- a/hsweb-system/hsweb-system-file/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,3 +0,0 @@ -# Auto Configure -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -org.hswebframework.web.file.FileServiceConfiguration \ No newline at end of file diff --git a/hsweb-system/hsweb-system-file/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/hsweb-system/hsweb-system-file/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 000000000..b7ff56290 --- /dev/null +++ b/hsweb-system/hsweb-system-file/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.hswebframework.web.file.FileServiceConfiguration \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3a4563662..1ac94d212 100644 --- a/pom.xml +++ b/pom.xml @@ -220,11 +220,14 @@ org.apache.maven.plugins maven-compiler-plugin - 3.10.1 + 3.11.0 ${project.build.jdk} ${project.build.jdk} ${project.build.sourceEncoding} + + -parameters +