I am writing a Spring application and I use Quart Scheduler.

I'm running Jetty server and everything is ok, my app works:

enter image description here

I am sending an HTTP request to the one of my services and then, everything is refreshing:

enter image description here

and Quartz gives this log 3 times: enter image description here

Here is a piece of my config.xml file:

<bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">

    <property name="jobDetail" ref="fileimport" />
    <property name="repeatInterval" value="${prop.checkinterval}" />

</bean>

<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
    <property name="jobDetails">
        <list>
            <ref bean="fileimport" />
        </list>
    </property>

    <property name="triggers">
        <list>
            <ref bean="simpleTrigger" />
            </list>
    </property>
</bean>

How can I load context once, during startup, and use it later without refreshing?

有帮助吗?

解决方案

Your problem here is that the context is reload each time when you load your XML file. Try to create different XML files for each Java Class and then, load each of them just once.

You can use it us a private static field of your class.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top