- springboot + jpa自动生成数据库(oracle)表出现表存在错误
在application.properties中加上spring.jpa.properties.hibernate.default_schema=[user],由于oracle不同表空间下可以有同名表,而表的访问都是user.table,这样来区分不同表空间同名表造成的问题。
- springboot + jpa 出现 failed to lazily initialize a collection of role错误
这个错误一般是在使用@ManyToMany @OneToMany默认加载方式为FetchType.LAZY导致,因此延迟加载设置,在加载延迟数据时session已关闭导致,两种解决方案:①加载方式改为FetchType.EAGER;②在application.properties中加上:
spring.jpa.open-in-view=true(默认)
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
- ajax访问本地json文件
chrome:添加--allow-file-access-from-files
firefox :about:config->security.fileuri.strict_origin_policy=false
- thymeleaf对html严格检查的处理方式
在application.properties中添加th:replace="::app-content"
添加依赖:
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.21</version>
</dependency>
- 在spring使用缓存时出现异常,EL1008E
检测是否有使用类似@CacheAbel这样的注解,同时其key的值不要为纯字符串,可以为SpEL表达式,如果是字符串写法应该是:"'key'"