redis在SpringBoot中的简单应用

程序参考:https://blog.csdn.net/qq_27790011/article/details/98344732

简述配置:2020.1 IDEA,JDK8

碰到的问题总结:

  问题一:Consider defining a bean of type 'java.lang.String' in your configuration.

  解决方法:在实例化的类里加入无参的构造方法

  

  问题二:Redis connection timed out

  解决方法:确认application.properties文件里的port是否和cmd里client的端口号一致

  

  问题三:[THYMELEAF][http-nio-8080-exec-1] Exception processing template "getUser": Error resolving template [getUser], template might not exist or might not be accessible by any of the configured Template Resolvers

  解决方法:在@RequestMapping("/getUser")上加@ResponseBody

  

  问题四:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSessionController':Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'port' in value "${port}"

  问题描述:@Value("${port}") 错误 ; 我的application.properties文件写的是spring.redis.port=6379

  问题解决:@Value("${spring.redis.port}") //正确

补充使用IDEA讲项目打包为jar:https://blog.csdn.net/weixin_38201936/article/details/88018493

感谢观看!

posted @ 2020-11-10 19:17  LPC_M  阅读(123)  评论(0)    收藏  举报