@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)

时间:2019-02-21 18:50:45   收藏:0   阅读:3445

 参考网上的博客  敲spring boot 发现一个问题,困扰了半天,在这里记录下:

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) 的 作用是  :取消数据库配置。

所以在用到数据库的时候记得将他改为 @SpringBootApplication , 否则会报错:如下
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘xxController‘: Unsatisfied dependency expressed through field ‘xxMapper‘; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘xxMapper‘ defined in file [D:\workspacesidea\pear\target\classes\com\wqq\mapper\xxMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required

原文:https://www.cnblogs.com/apple12/p/10414205.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!