Petar Petrov
Petar Petrov

Reputation: 596

Spring versions incompatibility

I'm working on a project where we use Spring and Spring Security.

Our current Spring version is 4.0.6.RELEASE and our Spring Security version is 4.0.0.M1. I try to migrate to higher version of Spring Security 4.0.2 Release but when I run my web app some functionality throws NoSuchMethodError. I read that this may be incompatibility of versions. My question is what is the best Security for Spring's current's version?

Upvotes: 0

Views: 255

Answers (2)

Sunil Kumar
Sunil Kumar

Reputation: 5657

Spring Security will be compiled and built on specific Spring version. And below is the compatible version of Spring Security with Spring version.

Spring security 4.0.2.RELEASE is built on Spring version 4.3.2.RELEASE
Spring security 4.0.1.RELEASE is built on Spring version 4.3.2.RELEASE
Spring security 4.0.0.RELEASE is built on Spring version 4.1.6.RELEASE

In your case, as your Spring version is 4.0.6.RELEASE, so you should not upgrade your Spring Security version else you may get errors like NoClassDefFound or NoSuchMethod.

In fact you should use Spring Security version as 3.2.9.RELEASE.

Upvotes: 2

Petar Petrov
Petar Petrov

Reputation: 596

The problem was that I have the following dependency for Spring Security:

spring-security-web
spring-security-config
spring-security-taglibs
spring-security-test

This dependencies set default spring-security-core to default version 3.2.4.RELEASE which doesn't have all methods which the higher Spring Security methods use.

The Solution is to add spring-security-core dependency which override the default version.

Upvotes: 0

Related Questions