Blog Archives
Spring security with spring framework 4.0
Posted by ChandanPandey
If you notice, spring security and spring framework are not at same level -spring security is 3.2.* while spring framework is at 4.0.*. If you try these two combination, then you might run in some class loading conflicts such as :
java.lang.NoClassDefFoundError: org/springframework/core/type/AnnotatedTypeMetadata
Why does this happen -JARS conflict.Check out maven dependency in your project -are all spring jars except spring security at same version?For me it was not -The spring-bean and spring-context were at 3.8 while spring web and spring web mvc at 4.0 -reason I have explicitly added dependency for spring web and spring-webmvc with version number -but context and bean were pulled through transitive depedency management of maven!
To make sure the JARS are at same version, declare them explicitly in maven -for example I end up declaring spring-bean and spring-context. This solved the issue.
This link have a detailed discussion.