Announcement Announcement Module
Collapse
No announcement yet.
DefaultAdvisorAutoProxyCreator skips some beans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • DefaultAdvisorAutoProxyCreator skips some beans

    Hi everybody,
    I'm using DefaultAdvisorAutoProxyCreator as an auto proxy creator in my project.But it looks autoproxycreator skips some beans.Guess I'm missing something.Can anyone help me ?

    Thanks

    Here is my context file
    <bean id="autoProxyCreator"
    class="org.springframework.aop.framework.autoproxy .DefaultAdvisorAutoProxyCreator">
    </bean>

    <!-- Hibernate Template Defintion -->
    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.Hibernat eTemplate">
    <property name="sessionFactory"><ref bean="sessionFactory"/></property>
    <property name="jdbcExceptionTranslator"><ref bean="jdbcExceptionTranslator"/></property>
    </bean>

    <!-- Generic DAO - can be used when doing standard CRUD -->
    <bean id="genDAO" class="com.m2m.dao.hibernate.GenDAOHibernate">
    <property name="hibernateTemplate"><ref bean="hibernateTemplate"/></property>
    </bean>

    <!-- This bean skiping by proxy creator >
    <bean id="sampleCachedDAO" class="com.m2m.cache.test.TestTable1CachedDAO" lazy-init="false">
    <property name="hibernateTemplate"><ref bean="hibernateTemplate"/></property>
    </bean>

    <bean id="cacheAdvisor" class="com.m2m.cache.CacheAdvisor" depends-on="sampleCachedDAO">
    <property name="cacheManager"><ref bean="cacheManager"/></property>
    <property name="clusterEventPublisher"> <ref bean="clusterEventPublisher"/></property>
    </bean>


    This is some part of my advisor

    public class CacheAdvisor implements PointcutAdvisor, Pointcut, MethodMatcher,
    ClassFilter, MethodInterceptor {
    ...
    public boolean matches(Class clazz) {
    //this code works for most of beans
    log.debug("Cache Advisor cheking " + clazz +" is matching or not");
    ...
    }

    And this is my log
    [ADF] DEBUG [main] CacheAdvisor.matches(91) | Cache Advisor cheking class com.m2m.dao.hibernate.GenDAOHibernate is matching or not
    [ADF] DEBUG [main] CacheAdvisor.matches(91) | Cache Advisor cheking class com.m2m.service.GenericSrv is matching or not
    [ADF] DEBUG [main] CacheAdvisor.matches(91) | Cache Advisor cheking class com.m2m.cluster.test.ClusterEventListenerTestBean is matching or not
    [ADF] DEBUG [main] CacheAdvisor.matches(91) | Cache Advisor cheking class com.m2m.cluster.dao.DAOClusterEventLocalPublisher is matching or not[/b]

  • #2
    Ref beans

    I realized something.When I declare a bean as a reference for another bean , DefaultAdvisorAutoProxyCreator doesn't accept that bean as a proxy target anymore.Is this normal behavior of Spring or a bug ?Any suggestions ?

    Comment


    • #3
      default autoproxying &quot;eligibility&quot;?

      Originally posted by serhat
      I realized something.When I declare a bean as a reference for another bean , DefaultAdvisorAutoProxyCreator doesn't accept that bean as a proxy target anymore.Is this normal behavior of Spring or a bug ?Any suggestions ?
      I've got the same question. I can't find anywhere in the documentation why certain beans are "not eligible" for the default autoproxying. Here is the message sample:

      12-Jul-2005 4:08:45 PM org.springframework.context.support.AbstractApplic ationContext$BeanPostProcessorChecker postProcessAfterInitialization
      INFO: Bean 'financialServiceImpl' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying
      12-Jul-2005 4:08:45 PM org.springframework.context.support.AbstractApplic ationContext$BeanPostProcessorChecker postProcessAfterInitialization

      Comment


      • #4
        Hi Venuko ,
        If you instansiate any bean before DefaultAdvisorAutoProxyCreator reaches them , they becomes not eligable for autoproxying.
        if you have any BeanFactoryPostProcessor implementation , do not get and instansiate any bean in postProcessBeanFactory method.
        This was the my problem and it's answer.I hope it helps you too.

        Comment

        Working...
        X