1. 程式人生 > >springboot+jpa+mysql+redis+swagger整合步驟

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

cti pom bsp mysql 方式 引入 ger value mys

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

在電腦上先安裝redis:

一、在pom.xml中引入redis

技術分享圖片

二、在application.yml裏配置redis,單獨說明:redis剛一開始安裝好是沒有設置密碼的。否則,會報connection錯誤。

技術分享圖片

三、在service配置Redis,需要說明的在方法前配置@Cacheable中只有value沒有可以,key默認跟value一樣。

技術分享圖片

四、在controller裏實現Redis的一種方式

技術分享圖片

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