zl程序教程

您现在的位置是:首页 >  后端

当前栏目

SpringBoot错误信息总结(不定时更新)

SpringBoot 总结 更新 定时 错误信息
2023-09-27 14:24:55 时间

1、“ java.lang.IllegalStateException: @Bean method ShiroConfig.cacheManager called as a bean reference for type [org.apache.shiro.cache.ehcache.EhCacheManager] but overridden by non-compatible bean instance of type [org.springframework.cache.support.NoOpCacheManager]. Overriding bean of same name declared in: class path resource [org/springframework/boot/autoconfigure/cache/NoOpCacheConfiguration.class]”
解决方案:下面两个jar冲突了,删除springboot-cache即可:
```xml

org.springframework.boot
spring-boot-starter-cache

org.apache.shiro
shiro-ehcache
${shiro.version}

2、其实SpringBoot可以自带同时读取yml和propertites文件属性的类“org.springframework.boot.bind.RelaxedPropertyResolver;”通过该类的“getProperty()”方法既可以读取yml配置文件的属性,包括自定义属性也可以读取properties格式文件的自定义属性,网上的教程都不明说这一点,自己亲自实践是可以的。其实,我感觉SpringBoot的yml和properties文件格式可以通用的,没有问题,网上的教程都不完整,比如yml格式文件也可以用多个文件配置多环境等,自己实践总结出来,Mark一下!
3、“return \"redirect:/admin/login\"”和“return \"/admin/login\"”由于前者会重定向跳转的是控制器,后者是找视图,会找对应目录下的视图文件,不用跳转控制器!另外,前者重定向之后是会产生新的session,地址栏也会发生变化,后者不会!