开发者社区 问答 正文

SpringBoot @EnableAutoConfiguration注解报错?报错

@SpringBootApplication used in default package
Redundant @ComponentScan declaration
Redundant @EnableAutoConfiguration declaratio

 

用的是JDK11

展开
收起
爱吃鱼的程序员 2020-06-06 10:35:10 1543 分享 版权
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
                        <p>换成jdk8试试 </p>
                    
    
                            还是这样不过项目可以启动运行也没报错
                        
    
                        <p>@SpringBootApplication  包括了ComponentScan和EnableAutoConfiguration,不过它只扫描默认的路径,即当前添加@SpringBootApplication 的类的包路径及其子路径,如果你只使用EnableAutoConfiguration,需要再加上ComponentScan ,指定扫描的路径。<a>https://www.cnblogs.com/wgslucky/p/9795596.html</a>,我这个项目是spring boot 和mybatis的整合,就只使用了@SpringBootApplication</p>
    
    2020-06-06 10:35:30
    赞同 展开评论