springboot结合redis使用CachingConfigurerSupport方法不能被继承

来源:互联网 发布:linux exit函数作用 编辑:程序博客网 时间:2024/06/03 15:28

关于 springboot结合redis使用CachingConfigurerSupport方法不能被继承:

今日在开发中遇到了一个棘手的问题,就是redis中CachingConfigurerSupport方法不能继承的问题,原来的springboot的代码为:

<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>1.1.9.RELEASE</version></parent><!-- Add typical dependencies for a web application --><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency></dependencies>
这代码诈一看上去没啥问题,可是结合redis的时候问题就来了,redisConfig不能继承CachingConfigurerSupport类,这个类是在配置当中必须使用的。最后的解决方法就是——————修改springboot版本,现在我用的是1.1.9版本的springboot,这样的话就没有CachingConfigurerSupport类,深入点说就是spring-context-support类中没有CachingConfigurerSupport,这时我们将版本升级到1.2.3的时候,就会出现这个类,困扰了一天的问题特此记录,也希望遇到这个问题的人少走弯路。

修改之后的代码为:

<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>1.2.3.RELEASE</version></parent><!-- Add typical dependencies for a web application --><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency></dependencies>

开发中经常遇到版本的问题,这类问题也是很头疼的,大家尽量避免吧


0 0