Springboot 利用 Jedis代码动态配置Redis
项目需求,甲方需求是处于安全的目的不想让properties里的部分配置信息体现在文件中,而且可能在之后需要通过页面修改对应的配置,所以出的解决方案就是部分配置信息存储在数据库里,然后利用@Bean注入的方式将其注入到springboot中,然后直接代码配置,例如:Redis。
环境
- Java 1.8
- Springboot 2.0
- MySQL 5.7
- Redis 3.0
pom
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artif