idea中maven+springboot整合连接虚拟机下的Re
2018-11-27 本文已影响0人
天莫邪_d169
1、首先pom.xml中的依赖

2、application中加入的代码



3、application.properties中的配置

其中spring.redis.host是虚拟机的ip
spring.redis.password是redis的密码
可以输入ifconfig获得,ens33下的inet。
关于ens33下面没有ip的问题,可以参考:CentOS7 使用ifconfig命令 ENS33没有IP地址的解决办法 - 可均可可 - 博客园

常见问题参考:关于主机连接虚拟机centOS中的redis - huwenshang的博客 - CSDN博客
关于redis的其他操作:Java连接Redis - Redis教程™