• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Spring Advisor's

 
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a question about spring advisor. My project has been configured to use spring framework.
I have a logging advisor configured this way and it works fine

<bean id="loggingInterceptor"
class="gov.osc.spring.LoggingInterceptor" />

<bean id="loggingAdvisor"
class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
<property name="advice">
<ref bean="loggingInterceptor" />
</property>
<property name="pattern">
<value>com\..+Manager(IF)?\..+</value>
</property>
</bean>

To my knowledge we dont have any references to this bean. But it still works fine.
Is spring container smart enough to identify all the advisors when it reads the configuration file and applies the advisor to the beans? or is there any configuration we have to make it work?

Thanks in advance
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sheetal,

As it is working fine for you, so no issues..

Anyways for your knowledge, to invoke an interceptor we should provide the reference for "LoggingInterceptor" in urlMapping bean, like

<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="interceptors">
<list>
<ref bean="LoggingInterceptor"/>
</list>
</property>
</bean>
 
Poop goes in a willow feeder. Wipe with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!