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. error C2872: ‘ofstream’ : ambiguous symbol

    转自VC错误:http://www.vcerror.com/?p=1123 问题描述: 编译时出现: error C2872: 'ofstream' : ambiguous symbol error ...

  2. SharePoint 2013中PerformancePoint仪表板设计器连接Analysis Services 2012的问题

    在SharePoint 2013的PerformancePoint仪表板设计器在创建链接到AnalysisServices 2012的数据链接的时候,数据库列表无法获取服务器上的数据库.这个问题挺让人 ...

  3. 同步架构OR异步架构

    把智能系统比喻成KFC营业厅,处理器是窗口和窗口后面的服务员(把一个窗口当作一个核心),指令集是后面排队的人,窗口是数据吞吐量.当中午就餐人多的时候,一个窗口肯定忙不过来,这时候可以增加窗口,有两种方 ...

  4. cortable 使用方法

    星期一到星期六,早上六点到晚上六点.每隔两个小时 执行语句 0 6-18/2  * * 1-6 commond

  5. c++全局变量,局部变量,内存布局,默认初始化

    全局变量 定义在所有函数之外的变量,main函数之内的变量也是局部变量,Globle variable  未显示初始化时执行默认初始化 局部变量 定义在函数之内的变量,Local variable 未 ...

  6. HDU 1205 吃糖果 (鸽巢原理)

    题目链接:HDU 1205 Problem Description HOHO,终于从Speakless手上赢走了所有的糖果,是Gardon吃糖果时有个特殊的癖好,就是不喜欢将一样的糖果放在一起吃,喜欢 ...

  7. LeetCode 95. Unique Binary Search Trees II 动态演示

    比如输入为n, 这道题目就是让返回由1,2,... n的组成的所有二叉排序树,每个树都必须包含这n个数 这是二叉树的排列组合的题目.排列组合经常用DFS来解决. 这道题比如输入为3,也就是求start ...

  8. CF1241 D Sequence Sorting(离散化+DP)

    题意: 给定数组a[n],用两种操作: 1.将数组中所有值为x的数移至开头 2.将数组中所有值为x的数移至末尾 问,经过最少多少次操作,能将数组a[n]变为非递减的有序数列? (1<=n< ...

  9. [LeetCode] 196.删除重复的电子邮箱

    编写一个 SQL 查询,来删除 Person 表中所有重复的电子邮箱,重复的邮箱里只保留 Id 最小 的那个. +----+------------------+ | Id | Email | +-- ...

  10. Compile Linux Kernel on Ubuntu 12.04 LTS (Detailed)

    This tutorial will outline the process to compile your own kernel for Ubuntu. It will demonstrate bo ...