小编Rav*_*avi的帖子

使用自定义注释的组件扫描

我正在使用 maven 依赖项在另一个 spring boot 应用程序中将 spring boot 项目作为 jar 使用。仅当我启用来自微服务的自定义注释时,我才想对 jar 进行组件扫描。

@SpringBootApplication
//@ComponentScan({"com.jwt.security.*"})  To be removed by custom annotation
@MyCustomAnnotation  //If I provide this annotation then the security configuration of the jar should be enabled.
public class MicroserviceApplication1 {

    public static void main(String[] args) throws Exception {

        SpringApplication.run(MicroserviceApplication1.class, args);

    }

}
Run Code Online (Sandbox Code Playgroud)

请提出一些想法。

java spring annotations maven spring-boot

5
推荐指数
1
解决办法
1719
查看次数

标签 统计

annotations ×1

java ×1

maven ×1

spring ×1

spring-boot ×1