2008-01-14

Spring Security 2.0 + Spring 2.5 + Maven

If you're a Mavenite Spring 2.5 user, you'll need to jump through some extra hoops to use Spring Security 2, just as you had to when using Acegi with Spring 2.0.

First off you'll want to exclude org.springframework:spring-remoting and org.springframework:spring-support, as these two artifacts no longer exist in Spring 2.5.

In addition, you will most likely need to include org.springframework:spring-aop and org.springframework:spring-orm as dependencies, unless you're already using them.

That said, Spring Security's new config is nice. One particular security config file went from 118 lines to 24!

4 comments:

lektuvas said...

Hi,

where did you find the maven artifact for spring-security?

thanks

espenhw said...

Check out this blog entry for the details on Spring's milestone and snapshot repositories:

Deepa said...

Hi,
Can you please show me the contents of your pom file. I am running into java.lang.NoSuchMethodError: org.springframework.aop.config.AopNamespaceUtils.registerAutoProxyCreatorIfNecessary(Lorg/springframework/beans/factory/xml/ParserContext;Ljava/lang/Object;)

when I include spring security 2.0.3 with spring 2.5.5

If I switch back to spring 2.0.8 then everything works fine. I would prefer to use spring 2.5.x.

thanks

espenhw said...

Deepa,

That sounds like you're somehow getting the wrong version of the spring-aop artifact. Try using 'mvn dependency:tree -Dincludes=org.springframework' to debug the Spring part of your Maven dependencies; then use the dependencyManagement section of your POM to manage the version of all the Spring artifacts you use to the same version.

Hope this helps!