An attempt was made to call the method org.springframework.boot...RedisSessionConfiguration 的解决办法

版权声明:本文为博主原创文章,如果觉得写的不错需要转载,在转载时请注明博文出处! https://blog.csdn.net/Hello_World_QWP/article/details/83182196

问题概述

在项目编写过程中,因为项目需要遂加入了 session 管理的包,启动项目测试时,便出现启动失败,错误信息 “ An attempt was made to call the method org.springframework.boot.autoconfigure.session.RedisSessionConfiguration$SpringBootRedisHttpSessionConfiguration.setCleanupCron(Ljava/lang/String;)V but it does not exist. Its class,” 尝试调用该方法,但是该方法不存在 ,具体的错误内容如下图:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-10-19 14:11:41.241 ERROR 3968 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call the method org.springframework.boot.autoconfigure.session.RedisSessionConfiguration$SpringBootRedisHttpSessionConfiguration.setCleanupCron(Ljava/lang/String;)V but it does not exist. Its class, org.springframework.boot.autoconfigure.session.RedisSessionConfiguration$SpringBootRedisHttpSessionConfiguration, is available from the following locations:

    jar:file:/D:/Install_Applications/apache-maven-3.5.3/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.0.6.RELEASE/spring-boot-autoconfigure-2.0.6.RELEASE.jar!/org/springframework/boot/autoconfigure/session/RedisSessionConfiguration$SpringBootRedisHttpSessionConfiguration.class

It was loaded from the following location:

    file:/D:/Install_Applications/apache-maven-3.5.3/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.0.6.RELEASE/spring-boot-autoconfigure-2.0.6.RELEASE.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.boot.autoconfigure.session.RedisSessionConfiguration$SpringBootRedisHttpSessionConfiguration

如下图:

解决办法

关于这个问题,主要是为了在项目的实际生产环境中实现横向扩展时的 Session 管理而引入的,所以在项目的 pom.xml 文件中引入了 “ spring-session ” session 管理的包,如下图:

其实这个问题很简单,只需要在项目的配置文件中加入如下配置即可,如下图:

通过以上修改后,即可再次成功启动项目了,如下图:


好了,关于 An attempt was made to call the method org.springframework.boot...RedisSessionConfiguration 的解决办法  就写到这儿了,如果还有什么疑问或遇到什么问题欢迎扫码提问,也可以给我留言哦,我会一一详细的解答的。 
歇后语:“ 共同学习,共同进步 ”,也希望大家多多关注CSND的IT社区。


作       者: 华    仔
联系作者: [email protected]
来       源: CSDN (Chinese Software Developer Network)
原       文: https://blog.csdn.net/Hello_World_QWP/article/details/83182196
版权声明: 本文为博主原创文章,请在转载时务必注明博文出处!

猜你喜欢

转载自blog.csdn.net/Hello_World_QWP/article/details/83182196
今日推荐