springboot平常问题处理手记

springboot启动问题html

1.@Autowired报错Could not autowire. No beans of xxxjava

解决:只需在DAO接口加上@Component 或者 @Repositoryspring

参考:https://blog.csdn.net/Mr_EvanChen/article/details/84035445数据库

 

2.Consider defining a bean of type ‘XXX’ in your configuration.浏览器

解决:在启动类上加上@MapperScan或者@ComponentScan注解,手动指定application类要扫描哪些包下的注解,以下所示: springboot

@SpringBootApplication
@ComponentScan(basePackages = {"com.xxx.xxx.dao"})

参考:https://www.cnblogs.com/nananana/p/9333917.htmlmybatis

      https://blog.csdn.net/suxiexingchen/article/details/84984349app

 

3.Failed to configure a DataSource: 'url' attribute is not specified and no embeddide

问题:应用中没有配置datasource的一些相关属性,例如:地址值啊,数据库驱动啊,用户名啊,密码啊url

解决:application.properties文件中加spring.datasource相关配置

参考:https://blog.csdn.net/qq_40223688/article/details/88191732

 

4.org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException

问题:以前生成了引发异常的队列,一启动就报错

解决:浏览器打开http://192.168.0.100:15672/#/把以前相关的队列删除,再次启动不报错了

参考:https://www.cnblogs.com/javawxid/p/10855071.html

 

springboot运行中问题

1.mybatis-plus驼峰下划线转换问题

设置不用其下划线命名法,在MybatisPlusConfig.java中设置
MybatisSqlSessionFactoryBean mybatisPlus = new MybatisSqlSessionFactoryBean();
mybatisPlus.setDbColumnUnderline(true);

 也能够在application.yml配置

mybatis-plus:
    global-config:
        #驼峰下划线转换
        db-column-underline: true
相关文章
相关标签/搜索