|
|
|
@ -5385,6 +5385,7 @@ You can use these macros instead of the six-digit value, thus: `@Scheduled(cron |
|
|
|
|=== |
|
|
|
|=== |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[[scheduling-quartz]] |
|
|
|
[[scheduling-quartz]] |
|
|
|
=== Using the Quartz Scheduler |
|
|
|
=== Using the Quartz Scheduler |
|
|
|
|
|
|
|
|
|
|
|
@ -5440,7 +5441,6 @@ has it applied automatically: |
|
|
|
protected void executeInternal(JobExecutionContext ctx) throws JobExecutionException { |
|
|
|
protected void executeInternal(JobExecutionContext ctx) throws JobExecutionException { |
|
|
|
// do the actual work |
|
|
|
// do the actual work |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
---- |
|
|
|
---- |
|
|
|
|
|
|
|
|
|
|
|
@ -5560,11 +5560,19 @@ seconds and one running every morning at 6 AM. To finalize everything, we need t |
|
|
|
</bean> |
|
|
|
</bean> |
|
|
|
---- |
|
|
|
---- |
|
|
|
|
|
|
|
|
|
|
|
More properties are available for the `SchedulerFactoryBean`, such as the calendars |
|
|
|
More properties are available for the `SchedulerFactoryBean`, such as the calendars used by the |
|
|
|
used by the job details, properties to customize Quartz with, and others. See the |
|
|
|
job details, properties to customize Quartz with, and a Spring-provided JDBC DataSource. See |
|
|
|
{api-spring-framework}/scheduling/quartz/SchedulerFactoryBean.html[`SchedulerFactoryBean`] |
|
|
|
the {api-spring-framework}/scheduling/quartz/SchedulerFactoryBean.html[`SchedulerFactoryBean`] |
|
|
|
javadoc for more information. |
|
|
|
javadoc for more information. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NOTE: `SchedulerFactoryBean` also recognizes a `quartz.properties` file in the classpath, |
|
|
|
|
|
|
|
based on Quartz property keys, as with regular Quartz configuration. Please note that many |
|
|
|
|
|
|
|
`SchedulerFactoryBean` settings interact with common Quartz settings in the properties file; |
|
|
|
|
|
|
|
it is therefore not recommended to specify values at both levels. For example, do not set |
|
|
|
|
|
|
|
an "org.quartz.jobStore.class" property if you mean to rely on a Spring-provided DataSource, |
|
|
|
|
|
|
|
or specify an `org.springframework.scheduling.quartz.LocalDataSourceJobStore` variant which |
|
|
|
|
|
|
|
is a full-fledged replacement for the standard `org.quartz.impl.jdbcjobstore.JobStoreTX`. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -5866,7 +5874,6 @@ is updated in the cache. The following example shows how to use the `sync` attri |
|
|
|
---- |
|
|
|
---- |
|
|
|
<1> Using the `sync` attribute. |
|
|
|
<1> Using the `sync` attribute. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NOTE: This is an optional feature, and your favorite cache library may not support it. |
|
|
|
NOTE: This is an optional feature, and your favorite cache library may not support it. |
|
|
|
All `CacheManager` implementations provided by the core framework support it. See the |
|
|
|
All `CacheManager` implementations provided by the core framework support it. See the |
|
|
|
documentation of your cache provider for more details. |
|
|
|
documentation of your cache provider for more details. |
|
|
|
@ -6024,7 +6031,6 @@ all entries from the `books` cache: |
|
|
|
---- |
|
|
|
---- |
|
|
|
<1> Using the `allEntries` attribute to evict all entries from the cache. |
|
|
|
<1> Using the `allEntries` attribute to evict all entries from the cache. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This option comes in handy when an entire cache region needs to be cleared out. |
|
|
|
This option comes in handy when an entire cache region needs to be cleared out. |
|
|
|
Rather than evicting each entry (which would take a long time, since it is inefficient), |
|
|
|
Rather than evicting each entry (which would take a long time, since it is inefficient), |
|
|
|
all the entries are removed in one operation, as the preceding example shows. |
|
|
|
all the entries are removed in one operation, as the preceding example shows. |
|
|
|
@ -6083,7 +6089,6 @@ comes into play. The following examples uses `@CacheConfig` to set the name of t |
|
|
|
---- |
|
|
|
---- |
|
|
|
<1> Using `@CacheConfig` to set the name of the cache. |
|
|
|
<1> Using `@CacheConfig` to set the name of the cache. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`@CacheConfig` is a class-level annotation that allows sharing the cache names, |
|
|
|
`@CacheConfig` is a class-level annotation that allows sharing the cache names, |
|
|
|
the custom `KeyGenerator`, the custom `CacheManager`, and the custom `CacheResolver`. |
|
|
|
the custom `KeyGenerator`, the custom `CacheManager`, and the custom `CacheResolver`. |
|
|
|
Placing this annotation on the class does not turn on any caching operation. |
|
|
|
Placing this annotation on the class does not turn on any caching operation. |
|
|
|
@ -6224,11 +6229,11 @@ if you need to annotate non-public methods, as it changes the bytecode itself. |
|
|
|
**** |
|
|
|
**** |
|
|
|
|
|
|
|
|
|
|
|
TIP: Spring recommends that you only annotate concrete classes (and methods of concrete |
|
|
|
TIP: Spring recommends that you only annotate concrete classes (and methods of concrete |
|
|
|
classes) with the `@Cache{asterisk}` annotation, as opposed to annotating interfaces. |
|
|
|
classes) with the `@Cache{asterisk}` annotations, as opposed to annotating interfaces. |
|
|
|
You certainly can place the `@Cache{asterisk}` annotation on an interface (or an interface |
|
|
|
You certainly can place an `@Cache{asterisk}` annotation on an interface (or an interface |
|
|
|
method), but this works only as you would expect it to if you use the proxy mode (`mode="proxy"`). |
|
|
|
method), but this works only if you use the proxy mode (`mode="proxy"`). If you use the |
|
|
|
If you use the weaving-based aspect (`mode="aspectj"`), the caching settings are not |
|
|
|
weaving-based aspect (`mode="aspectj"`), the caching settings are not recognized on |
|
|
|
recognized by weaving infrastructure. |
|
|
|
interface-level declarations by the weaving infrastructure. |
|
|
|
|
|
|
|
|
|
|
|
NOTE: In proxy mode (the default), only external method calls coming in through the |
|
|
|
NOTE: In proxy mode (the default), only external method calls coming in through the |
|
|
|
proxy are intercepted. This means that self-invocation (in effect, a method within the |
|
|
|
proxy are intercepted. This means that self-invocation (in effect, a method within the |
|
|
|
@ -6365,7 +6370,6 @@ to customize the factory for each cache operation, as the following example show |
|
|
|
---- |
|
|
|
---- |
|
|
|
<1> Customizing the factory for this operation. |
|
|
|
<1> Customizing the factory for this operation. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NOTE: For all referenced classes, Spring tries to locate a bean with the given type. |
|
|
|
NOTE: For all referenced classes, Spring tries to locate a bean with the given type. |
|
|
|
If more than one match exists, a new instance is created and can use the regular |
|
|
|
If more than one match exists, a new instance is created and can use the regular |
|
|
|
bean lifecycle callbacks, such as dependency injection. |
|
|
|
bean lifecycle callbacks, such as dependency injection. |
|
|
|
|