异常1.集成SPRing Data JPA

异常信息摘要:

org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).

异常信息说明:不知道使用什么数据库,需要在pom.xml标注使用什么数据库,如h2 解决思路:修改pom.xml

<dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> </dependency>


异常2.集成MyBatis没有标注@Mapper注解

异常信息摘要:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.jege.spring.boot.mybatis.UserMapperTest': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean found for dependency [com.jege.spring.boot.mybatis.mapper.UserMapper]: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

异常信息说明:说mapper接口不能成功注入 解决思路:使用spring boot后没有去指定扫描那个包,所以必须标注@org.apache.ibatis.annotations.Mapper在接口类上面或者启动类标注@MapperScan(“com.jege.spring.boot.mybatis.mapper”)


异常3.启动类必须放入包里面

异常信息摘要:

** WARNING ** : Your applicationContext is unlikely to start due to a @ComponentScan of the default package.

异常信息说明:应用程序不能从根目录的包开始 Application.java 文件不能直接放在main/java文件夹下,必须要建一个包把他放进去


异常4.上传文件太大了

异常信息摘要:

org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field upfile exceeds its maximum permitted size of 1048576 bytes.

异常信息说明:默认最大上传大小为1M 解决思路:Spring Boot升级到1.4到这样配置

# MULTipART (MultipartProperties) spring.http.multipart.enabled=true # Enable support of multi-part uploads. spring.http.multipart.file-size-threshold=0 # Threshold after which files will be written to disk. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size. spring.http.multipart.location= # Intermediate location of uploaded files. spring.http.multipart.max-file-size=10Mb # Max file size. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size. spring.http.multipart.max-request-size=10Mb # Max request size. Values can use the suffixed "MB" or "KB" to indicate a Megabyte or Kilobyte size.

解决思路:Spring Boot版本1.3.x这样配置

multipart.maxFileSize=10Mb


异常5.tomcat版本问题

异常信息摘要:

java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()

异常信息说明:找不到对应的方法 在本地mvn springboot:run 运行都没有问题。由于本地JDK版本是1.8,默认版本是tomcat8;而服务器JDK版本是1.7。解决方法 指定 tomcat版本就可以了。

<properties> <tomcat.version>7.0.52</tomcat.version> </properties>

Spring Boot 菜鸟教程 异常 集锦相关推荐

  1. Spring Boot 菜鸟教程 12 EasyPoi导出Excel下载

    GitHub src="//ghbtns.com/github-btn.html?user=je-ge&repo=spring-boot&type=watch&cou ...

  2. Spring Boot 菜鸟教程 3 MyBatis

    GitHub src="//ghbtns.com/github-btn.html?user=je-ge&repo=spring-boot&type=watch&cou ...

  3. Spring Boot 菜鸟教程 application.properties 常用配置

    SPRING CONFIG (ConfigFileApplicationListener) spring.config.name 配置文件名称,默认为application spring.config ...

  4. spring boot 菜鸟教程学习:spring是一个超级大工厂能够管理java对象(bean)和他们之间的关系(依赖注入)

    springboot的java对象叫做bean 用一个叫依赖注入的方法来管理bean的依赖关系 说白了 就是bean是节点 依赖注入能够构建节点之间的关系 创建bean的三种方式 如何依赖注入?

  5. 全网Star最多「近20k」的Spring Boot开源教程 2019 年要继续更新了

    点击蓝色"程序猿DD"关注我哟 从2016年1月开始写博客,默默地更新<Spring Boot系列教程>,从无人问津到千万访问,作为一个独立站点(http://blog ...

  6. 全网Star最多(近20k)的Spring Boot开源教程 2019 年要继续更新了!

    从2016年1月开始写博客,默默地更新<Spring Boot系列教程>,从无人问津到千万访问,作为一个独立站点(http://blog.didispace.com),相信只有那些跟我一样 ...

  7. springboot做网站_Github点赞接近 100k 的Spring Boot学习教程+实战项目推荐!

    " 本文已经收录进:awesome-java (Github 上非常棒的 Java 开源项目集合) 很明显的一个现象,除了一些老项目,现在 Java 后端项目基本都是基于 Spring Bo ...

  8. Spring Boot入门教程(四十):微信支付集成-刷卡支付

    分享一个朋友的人工智能教程.比较通俗易懂,风趣幽默,感兴趣的朋友可以去看看. 一:准备工作 使用微信支付需要先开通服务号,然后还要开通微信支付,最后还要配置一些开发参数,过程比较多. 申请服务号(企业 ...

  9. Spring Boot 基础教程:集成 Knife4j

    前言 之前介绍了如何在 Spring Boot 中集成 Swagger2 和 Swagger3,对于我们日常的接口管理已经够用了.但是作为一个颜值党,无论是 Swagger2 还是 Swagger3, ...

最新文章

  1. TVM 优化 ARM GPU 上的移动深度学习
  2. 数据库分页存储过程(5)
  3. mysql sp cursoropen_三个重要的游标sp_cursoropen_MySQL
  4. 4月17日云栖精选夜读 | 在阿里做了五年技术主管,我有话想说
  5. 关于单纤与双纤光端机的区别介绍
  6. 【POJ - 1850】Code (组合数学,字符串另类排序)
  7. H.264的码率控制算法
  8. 由ViewStateException: The client disconnected想到的
  9. 我们自己搞了个数据库设计工具(客户端)
  10. PTA题---求两个有序序列中位数所体现的思想。
  11. win7旗舰版升级成win7SP1
  12. 【JSOI2015】bzoj4487 染色问题
  13. 《GPU编程与CG语言之阳春白雪下里巴人》 读书笔记1
  14. 软件测试中手机性能测试怎么做,软件测试之手机知与手机性能测试完整版.doc...
  15. 西蒙斯告诉你何为传奇人生 James Simons
  16. 华容道 java_Java-华容道
  17. matplotlib设置坐标轴颜色及画布背景色
  18. 二三层报头及IP分片详解
  19. 2015-4-20分享的pdf
  20. 2020年有哪些ERP系统软件

热门文章

  1. 网页正文获取易语言代码
  2. 2022-2028全球军用级电源行业调研及趋势分析报告
  3. c语言自定义关键词,C语言关键字详解
  4. VBA7的诞生-VBA将会继续存活下去
  5. Matlab信号处理笔记
  6. JVM C1 编译优化:空检查擦除
  7. 清华大学地学系全球超分3弧秒海陆DEM数据下载
  8. 财务会计U8-出纳管理-日记账导入
  9. RS485利用地址主动仲裁驱动
  10. linux内核uuid生成器测试