Monitoring Spring Beans in sub-application context

291 views
Skip to first unread message

flex...@googlemail.com

unread,
Feb 19, 2013, 11:50:42 AM2/19/13
to javam...@googlegroups.com
Hi everybody,

maybe this is a simple problem, but I haven't found a solution yet.

I'm working on a web application which uses sub-spring contexts. The web application starts a Spring context (master Spring context) and every time a session is started a sub Spring context is started which inherits from the master Spring context. Many Spring controlled services I'd like to monitor exist in the sub Spring context.

Currently the MonitoringSpringAdvisor is defined in the master Spring context:
    <bean id="facadeMonitoringAdvisor" class="net.bull.javamelody.MonitoringSpringAdvisor">
        <property name="pointcut">
            <bean class="org.springframework.aop.support.JdkRegexpMethodPointcut">
                <property name="pattern" value=".*.service.*" />
            </bean>
        </property>
    </bean>
The Monitoring runs but unfortunately only services defined in the master Spring context are monitored and nothing in the sub Spring context.

I tried to move the MonitoringSpringAdvisor into the sub Spring context but then no Spring controlled service was monitored. After that I had the MonitoringSpringAdvisor definition in master and sub Spring context, but that didn't help either.

Is there any possibility to have Spring activity monitored in master and sub Spring context?

Thank you in advance,
Christoph

flex...@googlemail.com

unread,
Mar 8, 2013, 3:39:56 AM3/8/13
to javam...@googlegroups.com
Hi everybody,

I found a solution for my problem. Ensure that each sub application context contains

    <import resource="classpath:net/bull/javamelody/monitoring-spring.xml" />

then monitoring works for the services contained in the sub application contexts.

Cheers,
Christoph

vees...@gmail.com

unread,
Jul 14, 2014, 5:06:09 AM7/14/14
to javam...@googlegroups.com
Thank you so much, saved my day.
Reply all
Reply to author
Forward
0 new messages