Hello,
I am using org.springframework.scheduling.quartz.MethodInvoki ngJobDetailFactoryBean in my application context as part of a quartz scheduling process. I need this class to get a new instance of the target class every time it triggers. I have defined all of my beans as prototype for concurrency purposes but the factory bean keeps using the same instance of the target. How can I configure to use a new instance?
HTML Code:in applicationContext.xml: <bean id="launch" class="net.tds.daemon.service.LaunchControlsAuditDriver" scope="prototype"/> in schedulerContext.xml: <import resource="classpath:applicationContext.xml"/> <bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <property name="targetObject" ref="launch" /> <property name="targetMethod" value="run" /> <property name="concurrent" value="true" /> </bean> <bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail" ref="jobDetail" /> <property name="cronExpression" value="${cron.expression}" /> </bean> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="configLocation" value="classpath:quartz.properties"/> <property name="autoStartup" value="${auto.startup}"/> <property name="triggers"> <list> <ref bean="cronTrigger" /> </list> </property> </bean>


Reply With Quote
