org.springframework.context.event

Class EventPublicationInterceptor

  • java.lang.Object
    • org.springframework.context.event.EventPublicationInterceptor
    • Constructor Detail

      • EventPublicationInterceptor

        public EventPublicationInterceptor()
    • Method Detail

      • setApplicationEventClass

        public void setApplicationEventClass(java.lang.Class<?> applicationEventClass)
        Set the application event class to publish.

        The event class must have a constructor with a single Object argument for the event source. The interceptor will pass in the invoked object.

        Throws:
        java.lang.IllegalArgumentException - if the supplied Class is null or if it is not an ApplicationEvent subclass or if it does not expose a constructor that takes a single Object argument
      • setApplicationEventPublisher

        public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
        Description copied from interface: ApplicationEventPublisherAware
        Set the ApplicationEventPublisher that this object runs in.

        Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked before ApplicationContextAware's setApplicationContext.

        Specified by:
        setApplicationEventPublisher in interface ApplicationEventPublisherAware
        Parameters:
        applicationEventPublisher - event publisher to be used by this object
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Description copied from interface: InitializingBean
        Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

        This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.

        Specified by:
        afterPropertiesSet in interface InitializingBean
        Throws:
        java.lang.Exception - in the event of misconfiguration (such as failure to set an essential property) or if initialization fails for any other reason
      • invoke

        public java.lang.Object invoke(MethodInvocation invocation)
                                throws java.lang.Throwable
        Description copied from interface: MethodInterceptor
        Implement this method to perform extra treatments before and after the invocation. Polite implementations would certainly like to invoke Joinpoint.proceed().
        Specified by:
        invoke in interface MethodInterceptor
        Parameters:
        invocation - the method invocation joinpoint
        Returns:
        the result of the call to Joinpoint.proceed(); might be intercepted by the interceptor
        Throws:
        java.lang.Throwable - if the interceptors or the target object throws an exception