Java跨模块无法扫描到controller问题解决

1.java跨模块扫描controller必须要在@SpringBootApplication中进行定义

@SpringBootApplication(scanBasePackages = {"cn.iocoder.yudao.server","cn.iocoder.yudao.module.system.controller.admin.captcha"})
//这里在其他包定义controller的时候,必须得在scanBasePackages中定义扫描的位置,否则controller将无法生效。
@EnableAutoConfiguration
public class YudaoServerApplicatioin {
    public static void main(String[] args) {
        SpringApplication.run(YudaoServerApplicatioin.class,args);
    }
}

2.java运行之前配置包不能配置太多,否则会报下面的错误:

Exception in thread "main" java.lang.NoClassDefFoundError 
Create breakpoint: org/springframework/core/env/Environment
at cn.iocoder.yudao.server.YudaoServerApplication.main(YudaoServerApplication.java:12)

你可能感兴趣的:(芋道后端项目学习笔记,java,开发语言)