【问题标题】:Spring Boot Application add external library component scanSpring Boot Application添加外部库组件扫描
【发布时间】:2023-01-19 17:27:22
【问题描述】:

我有一个 spring boot 应用程序,它有一个库作为依赖项。在这个库中,我有几个 @Component@Configuration 类,它们没有被 Spring Boot 应用程序扫描。我想将它们添加到组件扫描中,但我做不到

如何正确实现这一点?我认为将 @ComponentScan 添加到 MainApp 类,用 @SpringBootApplication 注释将覆盖默认配置

谢谢!

【问题讨论】:

    标签: java spring spring-boot


    【解决方案1】:

    在主类中使用@ComponentScan,您可以根据需要使用basePackages 进行编译。

    【讨论】:

      猜你喜欢
      • 2019-02-16
      • 1970-01-01
      • 2015-12-12
      • 1970-01-01
      • 2015-05-14
      • 2014-10-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多