Hi all,
I've some problems to make Spring MVC + Spring AOP work together.
When i'm running tests aop works fine but doesn't on Tomcat/Jboss server.
My aop config is declared in the applicationContext.xml, aop classes (@Aspect + @Component) are in the com.company.fmk.framework package.
applicationContext.xml :
applicationContext-security.xml (irrelevant ?) :Code:<import resource="applicationContext-infrastructure.xml"/> <import resource="applicationContext-security.xml"/> <context:component-scan base-package="com.company.fmk.framework, com.company.fmk.repository, com.company.fmk.security, com.company.fmk.service" /> <aop:aspectj-autoproxy />
dispatcher-servlet.xml :Code:<security:http pattern="/static/**" security="none" /> <security:http use-expressions="true" auto-config="false" entry-point-ref="linkForbiddenEntryPoint"> <security:intercept-url pattern="/authError.html" access="permitAll"/> <security:intercept-url pattern="/**" access="hasAnyRole('ROLE_USER','ROLE_ADMIN')" /> <security:custom-filter position="PRE_AUTH_FILTER" ref="preAuthFilter" /> <security:logout invalidate-session="true" logout-url="/logout" /> </security:http> <bean id="preAuthenticationProvider" class="org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider"> <property name="preAuthenticatedUserDetailsService" ref="userAuthenticationService" /> </bean> <bean id="preAuthFilter" class="com.sopragroup.fmk.security.RequestAuthenticationFilter"> <property name="authenticationManager" ref="authenticationManager" /> </bean> <security:authentication-manager alias="authenticationManager"> <security:authentication-provider ref="preAuthenticationProvider" /> </security:authentication-manager>
web.xml :Code:<context:component-scan base-package="com.company.fmk.web"/> <mvc:default-servlet-handler/> <mvc:annotation-driven /> ... some thymeleaf conf ...
I can't understand what i'm doing wrong, i've read 10 post about Spring mvc + Spring aop problems but i was unable to find a suitable solution.Code:<context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:META-INF/spring/applicationContext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> </listener> <listener> <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class> </listener> <servlet> <servlet-name>dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
I would greatly appreciate if someone could help me.
Thanks for any suggestions.


Reply With Quote