您的位置:首页 > 移动开发

关于spring boot 中App类位置不同导致出错的问题的解决方法

2017-09-21 15:48 876 查看
@Configuration @EnableAutoConfiguration @ComponentScan这三个注解默认以main class所在目录作为根节点扫描classpath. @ComponentScan扫描组件,比如@Service,@Configuration等,@EnableAutoConfiguration扫描@Entity。

@SpringBootApplication的作用和以上三个注解等同。main class路径改变,也就是说Entity没有被扫描到。

解决办法:    https://stackoverflow.com/questions/30587377/springboot-componentscan-issue-with-multi-module-project

相关文档:1. https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-using-springbootapplication-annotation.html
                       2. https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-structuring-your-code.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐