Announcement Announcement Module
Collapse
No announcement yet.
BeanNameAutoProxyCreator Issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • rjmoran68
    started a topic BeanNameAutoProxyCreator Issue

    BeanNameAutoProxyCreator Issue

    I am having trouble getting the BeanNameAutoProxyCreator to work. When I configure a simple intreceptor with the ProxyBeanFactory it works fine, but when I attempt to do the same thing with the BeanNameAutoProxyCreator my bean is never proxied and the advice is never applied. I am not sure what I am doing wrong. Here is a portion of my configuration.

    <beans>
    <bean id="FullBookService" class="com.fmr.fiis.ws.fullbook.facade.CWsIPFullBo okFacadeImpl"/>

    <bean id="performanceThreshholdInterceptor" class="com.fmr.fiis.ws.fullbook.aop.CWsPerformance Interceptor">
    <constructor-arg>
    <value>3000</value>
    </constructor-arg>
    </bean>

    <bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy .BeanNameAutoProxyCreator">
    <property name="interceptorNames">
    <list>
    <value>performanceThreshholdInterceptor</value>
    </list>
    </property>
    <property name="beanNames">
    <list>
    <value>FullBookService</value>
    </list>
    </property>

    </bean>

  • rjmoran68
    replied
    re: BeanNameAutoProxyCreator Issue

    I will give that a try. Thanks for the help!

    Leave a comment:


  • hucmuc
    replied
    Re: Thanks for the response

    Looking at the code in GenericApplicationContext, you're right; you need to call refresh since it won't do it automatically.

    Why not use:

    final BeanFactory beanFactory = new ClassPathXmlApplicationContext(appContextFile);

    or
    final BeanFactory beanFactory = new FileSystemXmlApplicationContext(appContextFile);

    This will cut your lines of code to one line.

    Dino

    Leave a comment:


  • rjmoran68
    replied
    Thanks for the response

    I create the application context as follows:

    GenericApplicationContext ac = new GenericApplicationContext();

    //Create an XML Bean Definition Reader
    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ac);

    //Load The Bean Definitions
    xmlReader.loadBeanDefinitions(new InputStreamResource(input));

    //Refresh The Context
    ac.refresh();

    Perhaps I should a different constructor for the context. As is, it will not work unless I explicitly call refresh().

    Leave a comment:


  • hucmuc
    replied
    Re: I found the Problem

    Originally posted by rjmoran68
    I failed to call the refresh() method when creating the application context and loading the bean definitions. Apparently this is necessary for auto proxy functions.
    You shouldn't need to explicitly call refresh on the applicationContext (it is automatically called in the ApplicationContext constructor unless you specified false on one of the arguments).

    Dino

    Leave a comment:


  • rjmoran68
    replied
    I found the Problem

    I failed to call the refresh() method when creating the application context and loading the bean definitions. Apparently this is necessary for auto proxy functions.

    Leave a comment:

Working...
X