Results 1 to 4 of 4

Thread: DefaultAdvisorAutoProxyCreator skips some beans

  1. #1
    Join Date
    Jun 2005
    Location
    Istanbul , Turkey
    Posts
    3

    Default 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. #2
    Join Date
    Jun 2005
    Location
    Istanbul , Turkey
    Posts
    3

    Default 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 ?

  3. #3
    Join Date
    Jul 2005
    Location
    Vancouver, BC Canada
    Posts
    4

    Default default autoproxying "eligibility"?

    Quote 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

  4. #4
    Join Date
    Jun 2005
    Location
    Istanbul , Turkey
    Posts
    3

    Default

    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.

Similar Threads

  1. Spring container fails with no exception
    By naor in forum Container
    Replies: 9
    Last Post: Oct 1st, 2005, 03:39 PM
  2. Replies: 0
    Last Post: Aug 25th, 2005, 05:11 AM
  3. Replies: 4
    Last Post: Aug 17th, 2005, 04:42 AM
  4. Stack Overflow
    By rayho222 in forum Container
    Replies: 6
    Last Post: May 17th, 2005, 03:42 AM
  5. using commons-beanutils on Spring beans
    By boz in forum Container
    Replies: 6
    Last Post: Sep 25th, 2004, 12:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •