Spring Boot 报错记录

  1. 由于新建的项目没有配置数据库连接启动报错,可以通过取消自动数据源自动配置来解决

    解决方案1:

     @SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
    //@SpringBootApplication
    @MapperScan("com.example.*") //扫描:该包下相应的class,主要是MyBatis的持久化类.

    解决方案2:

     #去配置文件中配置数据库连接参数
    ########################################################
    ###datasource -- mysql\u7684\u6570\u636e\u5e93\u914d\u7f6e.
    ########################################################
    spring.datasource.url = jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8
    spring.datasource.username = root
    spring.datasource.password = root
    spring.datasource.driverClassName = com.mysql.jdbc.Driver
    spring.datasource.max-active=20
    spring.datasource.max-idle=8
    spring.datasource.min-idle=8
    spring.datasource.initial-size=10
  2. 热启动占用端口报错

    解决方案1:

     #在配置文件中修改端口号
    server.port=8888

    解决方案2:

     选择另外一种热启动方式,或者关闭端口
  3. 扫描包的注解 @MapperScan@ComponentScan 的区别

    首先,@ComponentScan是组件扫描注解,用来扫描@Controller  @Service  @Repository这类,主要就是定义扫描的路径从中找出标志了需要装配的类到Spring容器中

    其次,@MapperScan 是扫描mapper类的注解,就不用在每个mapper类上加@MapperScan了

    这两个注解是可以同时使用的。

     @SpringBootApplication
    //扫描:该包下相应的class,主要是MyBatis的持久化类.
    @MapperScan("com.example.mapper")
    //扫描controller、service等
    @ComponentScan(basePackages = { "com.example.controller", "com.example.service"})

Spring Boot 报错记录的更多相关文章

  1. Spring Boot报错 MultipartException The temporary upload...

    Spring Boot报错:尤其是在处理Ribbon这类接口调用型的负载均衡组件,常见问题 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.se ...

  2. 初学 Spring boot 报错 Whitelabel Error Page 404

    按照教程,写了个最简单的 HelloWorld,尼玛报错 -->Whitelabel Error Page 404. 网上99%都是项目结构不对,说什么 Application放在父级 pack ...

  3. 启动Spring boot报错:nested exception is java.sql.SQLException: Field 'id' doesn't have a default value

    先看具体日志: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with n ...

  4. spring boot 报错 Failed to read HTTP message

    2008-12-13 15:06:03,930 WARN (DefaultHandlerExceptionResolver.java:384)- Failed to read HTTP message ...

  5. Spring Boot 报错:Error creating bean with name 'entityManagerFactory' defined in class path resource

    spring boot 写一个web项目,在使用spring-data-jpa的时候,启动报如下错误: Error starting ApplicationContext. To display th ...

  6. Spring boot 报错 Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.

    在实际开发中修改别人的代码,发现了这个报错,后来发现是因为pom.xml里面 只要将注释掉的部分注释掉就好了.

  7. spring boot 报错 Error creating bean with name

    Application 启动类 要和父目录平级

  8. spring boot 报错

    错误1: 循环 的 请求. ..例如  cirle..url 在返回的模板路径上 加速 "/" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 错误2 : 添加了sh ...

  9. spring boot报错:Invalid bound statement (not found): com.

    经检查发现mapper的namespace没写全导致的 正确应该写成这样就可以了:

随机推荐

  1. php中class类文件引入方法汇总

    在项目中  总是会用到类文件引入的操作,在此简单总结下: 方法一: 使用  include,require,include_once,require_once. 其中:*_once  once意为曾经 ...

  2. Hive SQL语法总结

    Hive是一个数据仓库基础的应用工具,在Hadoop中用来处理结构化数据,它架构在Hadoop之上,通过SQL来对数据进行操作. Hive 查询操作过程严格遵守Hadoop MapReduce 的作业 ...

  3. 搭建邮件服务器 使用Postfix与Dovecot

    首先需要从yum中下载安装三个服务:bind-chroot    postfix     dovecot 配置文件依次: /etc/named.conf 下载安装完后要开启的服务:named     ...

  4. [已解决]报错: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Users/mac/Ana

    报错代码: pip3 install gerapy 报错内容: Could not install packages due to an EnvironmentError: [Errno 13] Pe ...

  5. iphoneX的适配问题

    iphoneX();function iphoneX(){ var oMeta = document.createElement('meta'); oMeta.setAttribute('name', ...

  6. 配置访问公网主机上的jupyter notebook

    文章结构: 一.安装python 二.安装并配置jupyter并配置jupyter 三.第一个python程序 一.安装python 1.1下载python安装包 # wget https://www ...

  7. MYSQL 查询脚本优化

    业务需要,优化一段多表查询脚本. 总结下来,采取以下步骤. 分析语句 分析语句,了解逻辑,是否可以先优化逻辑. 查询语句的查询范围,是否是全表查询,如果是,尽量优化为按索引查询. 查看语句数量,是否有 ...

  8. 利用Stream模式进行文件拷贝

    const fs = require('fs'); const file = fs.createReadStream("readfile.js"); const outputFil ...

  9. Android面向切面编程(AOP)(转)

    转自:https://www.jianshu.com/p/aa1112dbebc7 一.简述 1.AOP的概念 如果你用java做过后台开发,那么你一定知道AOP这个概念.如果不知道也无妨,套用百度百 ...

  10. Java网络编程:OSI七层模型和TCP/IP模型介绍

    OSI(Open System Interconnection),开放式系统互联参考模型 .是一个逻辑上的定义,一个规范,它把网络协议从逻辑上分为了7层.每一层都有相关.相对应的物理设备,比如常规的路 ...