Announcement Announcement Module
Collapse
No announcement yet.
BeanNameAutoProxyCreator Regexp to define beanNames patterns Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • BeanNameAutoProxyCreator Regexp to define beanNames patterns

    Hi,

    I would like to use regexp to define bean names (i.e
    Code:
    *myBean*DAO
    or
    Code:
    *myBean*Service
    ) in BeanNameAutoProxyCreator, but it does not work, the only pattern accepted is
    Code:
    myBean*
    .

    Code:
    <beans>
    	<bean id="my-debugInterceptor" 					class="org.springframework.aop.interceptor.DebugInterceptor"/>
    	<bean id="my-traceInterceptor" 					class="org.springframework.aop.interceptor.TraceInterceptor"/>
    	<bean id="my-performanceMonitorInterceptor" 		class="org.springframework.aop.interceptor.PerformanceMonitorInterceptor"/>
    	<bean id="my-jamonPerformanceMonitorInterceptor" 	class="org.springframework.aop.interceptor.JamonPerformanceMonitorInterceptor"/>
    
    
    <bean id="my-debugAutoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
    		<property name="interceptorNames">
    			<list>
    			   <idref bean="my-traceInterceptor"/>
    			   <idref bean="my-performanceMonitorInterceptor"/>
    			</list>
    		</property>
    		<property name="beanNames">
    			<list>
                                    <value>*myBean*DAO</value>
    				<value>*myBean*Service</value>
    			</list>
    		</property>
    	</bean>
    </beans>
    Any suggestion will be welcome , thanks in advance,

    Kinds regards,

    Steve

  • #2
    Code:
    *myBean*DAO
    and
    Code:
    *myBean*Service
    aren't valid regexps. You most likely want
    Code:
    .*myBean.*Dao
    and
    Code:
    .*myBean.*Service

    Comment


    • #3
      BeanNameAutoProxyCreator beanNames patterns

      Thanks for your help but it does not work, in fact it seems that usual regular expressions are not supported, may be the char '*' is just a pattern supported by BeanNameAutoProxyCreator class, this is why I wonder if another class exist in spring framework with regexp support ?

      Steve

      Comment


      • #4
        Oops, I wasn't paying enough attention. It seems that BeanNameAutoProxyCreator only accepts patterns that begin with * or end with * -- you can't have * in the middle somewhere. It doesn't look like there's a class with regexp support for what you want, but maybe take a look at DefaultAdvisorAutoProxyCreator.

        Comment

        Working...
        X