spring-boot开发过程中的问题汇总

  • 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'"

转载于:https://my.oschina.net/suspring/blog/1920165

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值