您的位置:首页 > 数据库 > Redis

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

2016-03-11 15:46 8173 查看
关于 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>


开发中经常遇到版本的问题,这类问题也是很头疼的,大家尽量避免吧
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: