Skip to content

Commit a7eeeda

Browse files
committed
Fix outdated references to JobDetailBean
Issue: SPR-12306 (cherry picked from commit aaf69eb)
1 parent 578c3dd commit a7eeeda

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

src/asciidoc/index.adoc

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6152,7 +6152,7 @@ support for autowiring of `@Bean` methods:
61526152
@Qualifier("public") TestBean spouse,
61536153
@Value("#{privateInstance.age}") String country) {
61546154
TestBean tb = new TestBean("protectedInstance", 1);
6155-
tb.setSpouse(tb);
6155+
tb.setSpouse(spouse);
61566156
tb.setCountry(country);
61576157
return tb;
61586158
}
@@ -44850,30 +44850,30 @@ classes that simplify the usage of Quartz within Spring-based applications.
4485044850

4485144851

4485244852
[[scheduling-quartz-jobdetail]]
44853-
==== Using the JobDetailBean
44854-
`JobDetail` objects contain all information needed to run a job. The Spring Framework
44855-
provides a `JobDetailBean` that makes the `JobDetail` more of an actual JavaBean with
44856-
sensible defaults. Let's have a look at an example:
44853+
==== Using the JobDetailFactoryBean
44854+
Quartz `JobDetail` objects contain all information needed to run a job. Spring provides a
44855+
`JobDetailFactoryBean` which provides bean-style properties for XML configuration purposes.
44856+
Let's have a look at an example:
4485744857

4485844858
[source,xml,indent=0]
4485944859
[subs="verbatim,quotes"]
4486044860
----
44861-
<bean name="exampleJob" class="org.springframework.scheduling.quartz.JobDetailBean">
44862-
<property name="jobClass" value="example.ExampleJob" />
44861+
<bean name="exampleJob" class="org.springframework.scheduling.quartz.JobDetailFactoryBean">
44862+
<property name="jobClass" value="example.ExampleJob"/>
4486344863
<property name="jobDataAsMap">
4486444864
<map>
44865-
<entry key="timeout" value="5" />
44865+
<entry key="timeout" value="5"/>
4486644866
</map>
4486744867
</property>
4486844868
</bean>
4486944869
----
4487044870

44871-
The job detail bean has all information it needs to run the job ( `ExampleJob`). The
44872-
timeout is specified in the job data map. The job data map is available through the
44873-
`JobExecutionContext` (passed to you at execution time), but the `JobDetailBean` also
44874-
maps the properties from the job data map to properties of the actual job. So in this
44875-
case, if the `ExampleJob` contains a property named `timeout`, the `JobDetailBean` will
44876-
automatically apply it:
44871+
The job detail configuration has all information it needs to run the job (`ExampleJob`).
44872+
The timeout is specified in the job data map. The job data map is available through the
44873+
`JobExecutionContext` (passed to you at execution time), but the `JobDetail` also gets
44874+
its properties from the job data mapped to properties of the job instance. So in this
44875+
case, if the `ExampleJob` contains a bean property named `timeout`, the `JobDetail`
44876+
will have it applied automatically:
4487744877

4487844878
[source,java,indent=0]
4487944879
[subs="verbatim,quotes"]
@@ -44886,7 +44886,7 @@ automatically apply it:
4488644886

4488744887
/**
4488844888
* Setter called after the ExampleJob is instantiated
44889-
* with the value from the JobDetailBean (5)
44889+
* with the value from the JobDetailFactoryBean (5)
4489044890
*/
4489144891
public void setTimeout(int timeout) {
4489244892
this.timeout = timeout;
@@ -44899,13 +44899,13 @@ automatically apply it:
4489944899
}
4490044900
----
4490144901

44902-
All additional settings from the job detail bean are of course available to you as well.
44902+
All additional properties from the job data map are of course available to you as well.
4490344903

4490444904
[NOTE]
4490544905
====
4490644906
Using the `name` and `group` properties, you can modify the name and the group
44907-
of the job, respectively. By default, the name of the job matches the bean name of the
44908-
job detail bean (in the example above, this is `exampleJob`).
44907+
of the job, respectively. By default, the name of the job matches the bean name
44908+
of the `JobDetailFactoryBean` (in the example above, this is `exampleJob`).
4490944909
====
4491044910

4491144911

@@ -44920,8 +44920,8 @@ Often you just need to invoke a method on a specific object. Using the
4492044920
[subs="verbatim,quotes"]
4492144921
----
4492244922
<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
44923-
<property name="targetObject" ref="exampleBusinessObject" />
44924-
<property name="targetMethod" value="doIt" />
44923+
<property name="targetObject" ref="exampleBusinessObject"/>
44924+
<property name="targetMethod" value="doIt"/>
4492544925
</bean>
4492644926
----
4492744927

@@ -44963,9 +44963,9 @@ job will not start before the first one has finished. To make jobs resulting fro
4496344963
[subs="verbatim,quotes"]
4496444964
----
4496544965
<bean id="jobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
44966-
<property name="targetObject" ref="exampleBusinessObject" />
44967-
<property name="targetMethod" value="doIt" />
44968-
<property name="concurrent" value="false" />
44966+
<property name="targetObject" ref="exampleBusinessObject"/>
44967+
<property name="targetMethod" value="doIt"/>
44968+
<property name="concurrent" value="false"/>
4496944969
</bean>
4497044970
----
4497144971

@@ -44997,17 +44997,17 @@ Find below a couple of examples:
4499744997
----
4499844998
<bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean">
4499944999
<!-- see the example of method invoking job above -->
45000-
<property name="jobDetail" ref="jobDetail" />
45000+
<property name="jobDetail" ref="jobDetail"/>
4500145001
<!-- 10 seconds -->
45002-
<property name="startDelay" value="10000" />
45002+
<property name="startDelay" value="10000"/>
4500345003
<!-- repeat every 50 seconds -->
45004-
<property name="repeatInterval" value="50000" />
45004+
<property name="repeatInterval" value="50000"/>
4500545005
</bean>
4500645006

4500745007
<bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
45008-
<property name="jobDetail" ref="exampleJob" />
45008+
<property name="jobDetail" ref="exampleJob"/>
4500945009
<!-- run every morning at 6 AM -->
45010-
<property name="cronExpression" value="0 0 6 * * ?" />
45010+
<property name="cronExpression" value="0 0 6 * * ?"/>
4501145011
</bean>
4501245012
----
4501345013

@@ -45021,8 +45021,8 @@ seconds and one every morning at 6 AM. To finalize everything, we need to set up
4502145021
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
4502245022
<property name="triggers">
4502345023
<list>
45024-
<ref bean="cronTrigger" />
45025-
<ref bean="simpleTrigger" />
45024+
<ref bean="cronTrigger"/>
45025+
<ref bean="simpleTrigger"/>
4502645026
</list>
4502745027
</property>
4502845028
</bean>

0 commit comments

Comments
 (0)