美文网首页
Springboot踩坑经历

Springboot踩坑经历

作者: 超巨大的门牙 | 来源:发表于2019-03-14 14:20 被阅读0次

bug1

The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone.

连接mysql是返回时区问题,在配置数据库url的时候一定要加上时区设置。

dataSource.setUrl("jdbc:mysql://localhost:3306/test?characterEncoding=utf8&serverTimezone=GMT%2B8")

bug2

No bean named 'entityManagerFactory' available

这是测试类没写全,书上给的教程没有提供完整的测试类程序清单,缺少了这个方法

public LocalContainerEntityManagerFactoryBean entityManagerFactory()

bug3

image.png

在写一个jsp页面的demo时,出现的问题,原因是jsp文件的目录写错了。
但网上有一些常见的问题如下:

  1. Application只能加载其同包或子包中的内容,所有controller的目录要注意
  2. 可以在@SpringBootApplication后面加上(scanBasePackages)

相关文章

网友评论

      本文标题:Springboot踩坑经历

      本文链接:https://www.haomeiwen.com/subject/irbqmqtx.html