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 MSB8008: 指定的平台工具集(v110)未安装或无效

    转自VC错误:http://www.vcerror.com/?p=318 问题描述: 平台工具集(v110)是vs2012下用的,你是用vs2010打开工程,它默认是用v100, 所以这个工程可能用v ...

  2. 慕课-tooltip提示框总结

    在慕课上学Waynej老师的tooltip浮动提示框,老师每次讲课都会强调搬砖的流程,这点在上了老师的几节课后宝宝终于体会到了: 分析→设计→编码→优化 分析:分析该功能到底是怎样的,其实就是需求分析 ...

  3. 【玩转SpringBoot】异步任务执行与其线程池配置

    同步代码写起来简单,但就是怕遇到耗时操作,会影响效率和吞吐量. 此时异步代码才是王者,但涉及多线程和线程池,以及异步结果的获取,写起来颇为麻烦. 不过在遇到SpringBoot异步任务时,这个问题就不 ...

  4. 【VisualStdio】在VS2015中显示上下文菜单中“创建单元测试”菜单

    ---恢复内容开始--- VS2012以后创建单元测试的选项被默认隐藏了,创建单元测试变得无比低效率.看msdn的说法好像是想推荐使用Intell Test来替代单元测试的用途,但是还没摸清楚也不敢瞎 ...

  5. 微众银行c++选择题后记

    一个类的成员可以有:另一个类的对象,类的自身指针,自身类对象的引用(私有的如何初始化呢,所以不行,换成静态的可以),自身类对象(构造时如何初始化呢?) class A{ public: A(){} A ...

  6. python读取mysql返回json

    python内部是以tuple格式存储的关系型数据库的查询结果,在实际的使用过程中可能需要转换成list或者dict,json等格式.在这里讲解如何将查询的结果转成json字符串.这里需要导入nump ...

  7. Numpy基础之创建与属性

    import numpy as np ''' 1.数组的创建:np.array([]) 2.数组对象的类型:type() 3.数据类型:a.dtype 4.数组的型shape:(4,2,3) 5.定义 ...

  8. Codefores 507B Amr and Pins

    B. Amr and Pins time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  9. MVC http://stackoverflow.com/tags/model-view-controller/info

    About model-view-controller Model–View–Controller (MVC) is an architectural pattern used in software ...

  10. spring 事物(一)—— 事物详解

    事务概念回顾 什么是事务? 事务是逻辑上的一组操作,要么都执行,要么都不执行. 事物的特性(ACID): 事务的特性 原子性: 事务是最小的执行单位,不允许分割.事务的原子性确保动作要么全部完成,要么 ...