springboot+jpa+mysql+redis+swagger整合步骤

springboot+jpa+MySQL+swagger框架搭建好之上再整合redis:

在电脑上先安装redis:

一、在pom.xml中引入redis

二、在application.yml里配置redis,单独说明:redis刚一开始安装好是没有设置密码的。否则,会报connection错误。

三、在service配置Redis,需要说明的在方法前配置@Cacheable中只有value没有可以,key默认跟value一样。

四、在controller里实现Redis的一种方式

 

posted @ 2018-09-15 17:15  小屈工作室  阅读(202)  评论(0编辑  收藏  举报