Announcement Announcement Module
No announcement yet.
AOP with Acegi Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • AOP with Acegi

    I don't know whether these two are interfering with eachother, but it's the best I can come up with.

    In our application, Acegi is configured through an XML. We're using Acegi since it's a rather "old" application. Spring Security wasn't released at the time my colleagues started the project . The configuration of Acegi with AOP looks like this:

        <aop:advisor id="userManagerTx" advice-ref="userManagerTxAdvice" pointcut="execution(* *..service.UserManager.*(..))" order="0"/>        
        <aop:advisor id="userManagerSecurity" advice-ref="userSecurityAdvice" pointcut="execution(* *..service.UserManager.saveUser(..))" order="1"/>
        <aop:advisor id="managerTx" advice-ref="txAdvice" pointcut="execution(* *..service.*Manager.*(..))" order="2"/>
    <tx:advice id="txAdvice">
            <tx:method name="get*" read-only="true"/>
            <tx:method name="save*" rollback-for="DataExistsException"/>
            <tx:method name="*"/>
    <tx:advice id="userManagerTxAdvice">
            <tx:method name="save*" rollback-for="UserExistsException"/>
    This configuration is placed in our Service layer. I do have to mention that this part isn't used yet.

    A few weeks ago we noticed that RDB suffered very hard if a user enters an empty value in some field in our forms. We don't have time to modify every module and every other web application, so I'm trying to intervene with AOP. Every time a user wants to create or update a record, an interceptor runs to check whether or not the user has entered the correct values.

    I created a MethodInterceptor, configured everything and deployed the application to Tomcat. Big surprise, it doesn't work. I started digging, searched for an answer on Google, but couldn't find what the actual problem was. You guys are my last hope .

    This is my configuration:

    <bean id="saveObjectInterceptor" class="be.brail.ctm.pricecode.aop.SaveOrUpdateInterceptor" />
        <bean id="saveOrUpdateAdvisor" class="">
    	<property name="advice">
    		<ref bean="saveObjectInterceptor" />
    	<property name="patterns">
    <bean id="saveUpdateProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
    	<property name="beanNames">
    	<property name="interceptorNames">
    This part is added to an XML file and lives in our DAO-layer.

    When I deployed my web application, a few stacktraces are thrown my way. This is the error message:

    java.lang.IllegalArgumentException: No matching editors or conversion strategy found
    at nvertIfNecessary(Ty
    I removed everything from Acegi in my application and when I run it, all is fine. Can someone tell me what the problem is? I've searched the message board for some answers, but couldn't find any.

  • #2
    This kind of message usually results when
    - you have a bean that got proxied based on its interface (instead of the class itself)
    - that bean is injected into another bean with the type specified as class (setDependency(MyClass) instead of setDependency(MyInterface)).

    If so, modifying the proxy creator to force the use of class-based proxy (setting its "optimize" property to true) might help.