Dual (scheduler) bean initialization

I have 2 contexts in my application, one is "spring" (Web + MVC), the second is "rpc" (only an RPC service). Both of them inherit configs from the spring directory (there are 4 files: app-config.xml, infrastructure-config.xml, integration-config.xml and security-config.xml).

The config.xml application contains the initialization of Quartz Scheduler.

So, if I run my application, there are two Quartz Scheduler threads, and all scheduled services are called twice. Is it because I inherit settings from app-confix.xml in both contexts?

I thought that beans defined in the parent config are initialized only once and shared between the context that inherits this parent configuration.

Thanks for any advice :).

An example from my web.xml.

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/spring/*-config.xml
    </param-value>
</context-param>

<servlet>
    <servlet-name>rpc</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>0</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>rpc</servlet-name>
    <url-pattern>/rpc/*</url-pattern>
</servlet-mapping>

<servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>/web/*</url-pattern>
</servlet-mapping>
+3
1

. , , spring .

, contextLoaderListener web.xml - . - .

+3

All Articles