[Logo]
Forums Register Login
Please explain the logic
Hi
I got the following Xml file from your forum and it is executing fine. But I can't understand what is happening, ie not able to understand the logic behind it. Here in the xml it refers the myScheduler bean first. Can you explain how the xml parser will decide which bean to refer first. Can you please explain the whole logic behind this with an example.



This is the Xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

<bean name="myJob" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>com.syntel.springapi.scheduler.MyJobHandler</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="job"><ref bean="myJobImpl" />
</entry>
</map></property>
</bean>

<bean id="mySimpleTrigger1" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail"><ref bean="myJob" />
</property>
<property name="startDelay">
<value>20000</value>
</property>
<property name="repeatInterval">
<value>10000</value>
</property></bean>

<bean id="exampleJobDetail2" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="exampleJob" />
<property name="targetMethod" value="doForMe" /></bean>

<bean id="mySimpleTrigger2" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail"><ref bean="exampleJobDetail2" />
</property>
<property name="startDelay">
<value>2000</value>
</property>
<property name="repeatInterval">
<value>1000</value>
</property></bean>

<bean id="exampleJob" class="com.syntel.springapi.scheduler.ExampleJob "/>

<bean id="myScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="mySimpleTrigger1"/>
<ref bean="mySimpleTrigger2"/>
</list>
</property>
</bean>

<bean id="myJobImpl" class="com.syntel.springapi.scheduler.MyJobImpl">
<property name="greeting">
<value>Have a great day !!</value>
</property>
</bean>
</beans>


Thanks and regards

Vidhu V S
Syntel Ltd
 
Originally posted by Vidhu V S:
But I can't understand what is happening, ie not able to understand the logic behind it. Here in the xml it refers the myScheduler bean first. Can you explain how the xml parser will decide which bean to refer first. Can you please explain the whole logic behind this with an example.

When you say you don't understand the logic, are you saying:
1)you don't understand the end result (Dependency Injection)
or
2)you understand the end result completely but don't understand how it happens
 
Originally posted by Marc Peabody:

When you say you don't understand the logic, are you saying:
1)you don't understand the end result (Dependency Injection)
or
2)you understand the end result completely but don't understand how it happens
 
Hi,

This is the reply to the message posted by Mr. Mac Peabody
I understand the end result completely but don't understand how it happens. Can you please explain that.
This is the Xml File:



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

<bean name="myJob" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>com.syntel.spring.scheduler.MyJobHandler</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="job"><ref bean="myJobImpl" />
</entry>
</map></property>
</bean>

<bean id="mySimpleTrigger1" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail"><ref bean="myJob" />
</property>
<property name="startDelay">
<value>20000</value>
</property>
<property name="repeatInterval">
<value>10000</value>
</property></bean>

<bean id="exampleJobDetail2" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="exampleJob" />
<property name="targetMethod" value="doForMe" /></bean>

<bean id="mySimpleTrigger2" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail"><ref bean="exampleJobDetail2" />
</property>
<property name="startDelay">
<value>2000</value>
</property>
<property name="repeatInterval">
<value>1000</value>
</property></bean>

<bean id="exampleJob" class="com.syntel.spring.scheduler.ExampleJob "/>

<bean id="myScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="mySimpleTrigger1"/>
<ref bean="mySimpleTrigger2"/>
</list>
</property>
</bean>

<bean id="myJobImpl" class="com.syntel.spring.scheduler.MyJobImpl">
<property name="greeting">
<value>Have a great day !!</value>
</property>
</bean>
</beans>

Thanks and regards
Vidhu V S
Syntel Ltd
"Vidhu V S", please check your private messages for an important administrative matter.
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Nov 21, 2017 01:19:03.