springboot项目中扫描其他模块的包中类


结构图:

 步骤:

1、在需要扫描的类中添加注解@Configuration,例如:

2、在service模块pom.xml中配置service_base依赖,artifactId中是模块名

<dependency>
            <groupId>com.fenggroupId>
            <artifactId>service_baseartifactId>
            <version>0.0.1-SNAPSHOTversion>
 dependency>

3、在EduApplication类中配置扫描路径

 结果(我是用swagger时使用的),成功打开service_base模块下的文件: