🚑 溢出自动配置类上的@Configuration注解,防止全包扫描时导致的误注入

This commit is contained in:
b2baccline
2020-04-17 16:16:53 +08:00
parent 99fdb7e52d
commit 3a6587b51d
6 changed files with 3 additions and 21 deletions

View File

@@ -12,10 +12,6 @@
<artifactId>ballcat-admin-core</artifactId>
<dependencies>
<dependency>
<groupId>com.hccake</groupId>
<artifactId>ballcat-common-job</artifactId>
</dependency>
<dependency>
<groupId>com.hccake</groupId>
<artifactId>ballcat-common-conf</artifactId>

View File

@@ -3,10 +3,8 @@ package com.hccake.ballcat.common.job;
import com.hccake.ballcat.common.job.properties.XxlJobProperties;
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* @author lengleng
@@ -15,9 +13,7 @@ import org.springframework.context.annotation.Import;
* xxl 初始化
*/
@Slf4j
@Configuration
@EnableAutoConfiguration
@Import(XxlJobProperties.class)
@EnableConfigurationProperties(XxlJobProperties.class)
public class XxlJobAutoConfiguration {
@Bean

View File

@@ -13,7 +13,7 @@ import org.springframework.context.annotation.Bean;
* @author Hccake
*/
@AllArgsConstructor
@EnableConfigurationProperties({FileStorageProperties.class})
@EnableConfigurationProperties(FileStorageProperties.class)
public class FileStorageAutoConfiguration {
private final FileStorageProperties properties;

View File

@@ -2,7 +2,6 @@ package com.hccake.ballcat.commom.storage;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* @author Hccake
@@ -10,7 +9,6 @@ import org.springframework.context.annotation.Configuration;
* @date 2019/7/16 15:34
*/
@Data
@Configuration
@ConfigurationProperties(prefix = "file.storage")
public class FileStorageProperties {

View File

@@ -1,10 +1,8 @@
package com.hccake.ballcat.common.swagger;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.util.CollectionUtils;
@@ -20,8 +18,6 @@ import java.util.List;
* @version 1.0
* @date 2019/11/1 20:03
*/
@Configuration
@EnableAutoConfiguration
@Import(SwaggerConfiguration.class)
@ConditionalOnProperty(name = "swagger.enabled", havingValue = "true", matchIfMissing = true)
public class SwaggerAggregatorAutoConfiguration {

View File

@@ -1,12 +1,10 @@
package com.hccake.ballcat.common.swagger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
@@ -17,8 +15,6 @@ import org.springframework.web.filter.CorsFilter;
* @version 1.0
* @date 2019/11/1 20:03
*/
@Configuration
@EnableAutoConfiguration
@Import(SwaggerConfiguration.class)
@ConditionalOnProperty(name = "swagger.enabled", havingValue = "true", matchIfMissing = true)
public class SwaggerProviderAutoConfiguration {