I have a ScheduledExecutor that runs on @PostConstruct of some of my @Service. however, this tomcat config causes 2 copies of @Service to run and removing either one would cause the @Controller in the wars to not work.
how to resolve this? i need the @Service to be singleton so that there is only one Executor that runs some code.
setting the Executor to static would make it one Executor only, but is there a way to achieve this at the config level?
web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
servlet-context.xml
<import resource="applicationContext.xml" />
applicationContext.xml
<bean id="properties" class="my.package.common.properties.MyPropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>WEB-INF/classes/system.properties</value>
<value>WEB-INF/classes/db.properties</value>
<value>WEB-INF/classes/applicationContext.properties</value>
</list>
</property>
</bean>
<context:annotation-config />
<context:component-scan base-package="my.package" />
