refactor(all): 简化代码 componentScan 注解的使用

This commit is contained in:
2023-05-01 15:54:03 +08:00
parent c076298683
commit a8f3b4c9bf
5 changed files with 32 additions and 31 deletions

View File

@@ -6,8 +6,6 @@ import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.retry.annotation.EnableRetry;
/**
@@ -17,10 +15,13 @@ import org.springframework.retry.annotation.EnableRetry;
* @date 2023-04-30
*/
@EnableDiscoveryClient
@SpringBootApplication(exclude = {GsonAutoConfiguration.class, DataSourceAutoConfiguration.class})
@ComponentScans({
@ComponentScan("com.lanyuanxiaoyao.service")
})
@SpringBootApplication(
scanBasePackages = {"com.lanyuanxiaoyao.service"},
exclude = {
GsonAutoConfiguration.class,
DataSourceAutoConfiguration.class
}
)
@EnableConfigurationProperties
@EnableRetry
public class FlinkQueryApplication {

View File

@@ -7,8 +7,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.scheduling.annotation.EnableScheduling;
@@ -19,11 +17,13 @@ import org.springframework.scheduling.annotation.EnableScheduling;
* @date 2023-04-24
*/
@EnableDiscoveryClient
@SpringBootApplication(exclude = {GsonAutoConfiguration.class})
@ComponentScans({
@ComponentScan("com.lanyuanxiaoyao.service"),
@ComponentScan("com.eshore.odcp.hudi.connector.utils.database"),
})
@SpringBootApplication(
scanBasePackages = {
"com.lanyuanxiaoyao.service",
"com.eshore.odcp.hudi.connector.utils.database"
},
exclude = {GsonAutoConfiguration.class}
)
@EnableConfigurationProperties
@EnableRetry
@EnableScheduling

View File

@@ -24,8 +24,6 @@ import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -36,10 +34,13 @@ import org.springframework.web.bind.annotation.RestController;
* @date 2023-04-27
*/
@EnableDiscoveryClient
@SpringBootApplication(exclude = {GsonAutoConfiguration.class, DataSourceAutoConfiguration.class})
@ComponentScans({
@ComponentScan("com.lanyuanxiaoyao.service")
})
@SpringBootApplication(
scanBasePackages = {"com.lanyuanxiaoyao.service"},
exclude = {
GsonAutoConfiguration.class,
DataSourceAutoConfiguration.class
}
)
@EnableConfigurationProperties
@EnableRetry
@RestController

View File

@@ -9,8 +9,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.scheduling.annotation.EnableAsync;
/**
@@ -19,10 +17,10 @@ import org.springframework.scheduling.annotation.EnableAsync;
* @author lanyuanxiaoyao
* @date 2023-04-21
*/
@SpringBootApplication(exclude = {GsonAutoConfiguration.class})
@ComponentScans({
@ComponentScan("com.lanyuanxiaoyao.service")
})
@SpringBootApplication(
scanBasePackages = {"com.lanyuanxiaoyao.service"},
exclude = {GsonAutoConfiguration.class}
)
@EnableDiscoveryClient
@EnableAsync
@EnableCaching

View File

@@ -11,8 +11,6 @@ import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.scheduling.annotation.EnableScheduling;
@@ -23,10 +21,13 @@ import org.springframework.scheduling.annotation.EnableScheduling;
* @date 2023-04-17
*/
@EnableDiscoveryClient
@SpringBootApplication(exclude = {GsonAutoConfiguration.class, DataSourceAutoConfiguration.class})
@ComponentScans({
@ComponentScan("com.lanyuanxiaoyao.service")
})
@SpringBootApplication(
scanBasePackages = {"com.lanyuanxiaoyao.service"},
exclude = {
GsonAutoConfiguration.class,
DataSourceAutoConfiguration.class
}
)
@EnableConfigurationProperties
@EnableRetry
@EnableScheduling