spring task Scheduled run twice

I encountered this issue 2 times. So want to record it.

1 -> component scan and xml bean definition

The 1st time i have this problem is the bean which contains the ‘@Scheduled’ method is annotated with @Component and also registered in the applicationContext.xml. This would make the task being scheduled twice.

2 -> two applicationContext.xml being registered.

The 2nd time I have this is in another project where struts is used. and in the struts config , here is something :

	<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
		<set-property property="contextConfigLocation"

Notice the 2nd file, which would register the application context again given the context has been initialized once in the web.xml.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s