Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.scheduling.annotation
Class ScheduledAnnotationBeanPostProcessor

    java.lang.Object
      org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor

All Implemented Interfaces:
  EventListener, BeanPostProcessor, DisposableBean, ApplicationContextAware, ApplicationListener<ContextRefreshedEvent>, EmbeddedValueResolverAware, Ordered

    public class ScheduledAnnotationBeanPostProcessor

extends Object
implements BeanPostProcessor, Ordered, EmbeddedValueResolverAware, ApplicationContextAware, ApplicationListener<ContextRefreshedEvent>, DisposableBean

Bean post-processor that registers methods annotated with `@Scheduled` to be invoked by a `TaskScheduler` according to the "fixedRate", "fixedDelay", or "cron" expression provided via the annotation.

Since:
  3.0
Author:
  Mark Fisher, Juergen Hoeller
See Also:
  `Scheduled`, `TaskScheduler`

Field Summary

Fields inherited from interface org.springframework.core.Ordered
`HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE`

Constructor Summary
`ScheduledAnnotationBeanPostProcessor()`

Method Summary
`void` | `destroy()` Invoked by a BeanFactory on destruction of a singleton.
`int` | `getOrder()` Return the order value of this object, with a higher value meaning greater in terms of sorting.
`void` | `onApplicationEvent(ContextRefreshedEvent event)` Handle an application event.
`Object` | `postProcessAfterInitialization(Object bean, String beanName)` Apply this BeanPostProcessor to the given new bean instance after any bean initialization callbacks (like InitializingBean's `afterPropertiesSet` or a custom init-method).
`Object` | `postProcessBeforeInitialization(Object bean, String beanName)` Apply this BeanPostProcessor to the given new bean instance before any bean initialization callbacks (like InitializingBean's `afterPropertiesSet` or a custom init-method).
`void` | `setApplicationContext(ApplicationContext applicationContext)` Set the ApplicationContext that this object runs in.
`void` | `setEmbeddedValueResolver(StringValueResolver resolver)` Set the StringValueResolver to use for resolving embedded definition values.
`void` | `setScheduler(Object scheduler)` Set the `TaskScheduler` that will invoke the scheduled methods, or a `ScheduledExecutorService` to be wrapped as a TaskScheduler.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ScheduledAnnotationBeanPostProcessor

    public ScheduledAnnotationBeanPostProcessor()

Method Detail

### setScheduler

    public void setScheduler(Object scheduler)

  Set the `TaskScheduler` that will invoke the scheduled methods, or a `ScheduledExecutorService` to be wrapped as a TaskScheduler.

### setEmbeddedValueResolver

    public void setEmbeddedValueResolver(StringValueResolver resolver)

  Description copied from interface: `EmbeddedValueResolverAware`
  Set the StringValueResolver to use for resolving embedded definition values.

  Specified by:
    `setEmbeddedValueResolver` in interface `EmbeddedValueResolverAware`

### setApplicationContext

    public void setApplicationContext(ApplicationContext applicationContext)

  Description copied from interface: `ApplicationContextAware`
  Set the ApplicationContext that this object runs in. Normally this call will be used to initialize the object.

  Invoked after population of normal bean properties but before an init callback such as `InitializingBean.afterPropertiesSet()` or a custom init-method. Invoked after `ResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader)`, `ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)` and `MessageSourceAware`, if applicable.

  Specified by:
    `setApplicationContext` in interface `ApplicationContextAware`
  Parameters:
    `applicationContext` - the ApplicationContext object to be used by this object
  See Also:
    `BeanInitializationException`

### getOrder

    public int getOrder()

  Description copied from interface: `Ordered`
  Return the order value of this object, with a higher value meaning greater in terms of sorting.

  Normally starting with 0, with `Integer.MAX_VALUE` indicating the greatest value. Same order values will result in arbitrary positions for the affected objects.

  Higher values can be interpreted as lower priority. As a consequence, the object with the lowest value has highest priority (somewhat analogous to Servlet "load-on-startup" values).

  Specified by:
    `getOrder` in interface `Ordered`
  Returns:
    the order value

### postProcessBeforeInitialization

    public Object postProcessBeforeInitialization(Object bean,
                                                  String beanName)

  Description copied from interface: `BeanPostProcessor`
  Apply this BeanPostProcessor to the given new bean instance before any bean initialization callbacks (like InitializingBean's `afterPropertiesSet` or a custom init-method). The bean will already be populated with property values. The returned bean instance may be a wrapper around the original.

  Specified by:
    `postProcessBeforeInitialization` in interface `BeanPostProcessor`
  Parameters:
    `bean` - the new bean instance
    `beanName` - the name of the bean
  Returns:
    the bean instance to use, either the original or a wrapped one; if `null`, no subsequent BeanPostProcessors will be invoked
  See Also:
    `InitializingBean.afterPropertiesSet()`

### postProcessAfterInitialization

    public Object postProcessAfterInitialization(Object bean,
                                                 String beanName)

  Description copied from interface: `BeanPostProcessor`
  Apply this BeanPostProcessor to the given new bean instance after any bean initialization callbacks (like InitializingBean's `afterPropertiesSet` or a custom init-method). The bean will already be populated with property values. The returned bean instance may be a wrapper around the original.

  In case of a FactoryBean, this callback will be invoked for both the FactoryBean instance and the objects created by the FactoryBean (as of Spring 2.0). The post-processor can decide whether to apply to either the FactoryBean or created objects or both through corresponding `bean instanceof FactoryBean` checks.

  This callback will also be invoked after a short-circuiting triggered by a `InstantiationAwareBeanPostProcessor.postProcessBeforeInstantiation(java.lang.Class, java.lang.String)` method, in contrast to all other BeanPostProcessor callbacks.

  Specified by:
    `postProcessAfterInitialization` in interface `BeanPostProcessor`
  Parameters:
    `bean` - the new bean instance
    `beanName` - the name of the bean
  Returns:
    the bean instance to use, either the original or a wrapped one; if `null`, no subsequent BeanPostProcessors will be invoked
  See Also:
    `InitializingBean.afterPropertiesSet()`, `FactoryBean`

### onApplicationEvent

    public void onApplicationEvent(ContextRefreshedEvent event)

  Description copied from interface: `ApplicationListener`
  Handle an application event.

  Specified by:
    `onApplicationEvent` in interface `ApplicationListener<ContextRefreshedEvent>`
  Parameters:
    `event` - the event to respond to

### destroy

    public void destroy()
                 throws Exception

  Description copied from interface: `DisposableBean`
  Invoked by a BeanFactory on destruction of a singleton.

  Specified by:
    `destroy` in interface `DisposableBean`
  Throws:
    `Exception` - in case of shutdown errors. Exceptions will get logged but not rethrown to allow other beans to release their resources too.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD