|
|
|
@ -8329,7 +8329,7 @@ synchronously. This means the `publishEvent()` method blocks until all listeners |
|
|
|
finished processing the event. One advantage of this synchronous and single-threaded |
|
|
|
finished processing the event. One advantage of this synchronous and single-threaded |
|
|
|
approach is that when a listener receives an event, it operates inside the transaction |
|
|
|
approach is that when a listener receives an event, it operates inside the transaction |
|
|
|
context of the publisher if a transaction context is available. If another strategy for |
|
|
|
context of the publisher if a transaction context is available. If another strategy for |
|
|
|
event publication becomes necessary, refer to the JavaDoc for Spring's |
|
|
|
event publication becomes necessary, refer to the javadoc for Spring's |
|
|
|
`ApplicationEventMulticaster` interface. |
|
|
|
`ApplicationEventMulticaster` interface. |
|
|
|
|
|
|
|
|
|
|
|
The following example shows the bean definitions used to register and configure each of |
|
|
|
The following example shows the bean definitions used to register and configure each of |
|
|
|
@ -8396,9 +8396,10 @@ follows: |
|
|
|
} |
|
|
|
} |
|
|
|
---- |
|
|
|
---- |
|
|
|
|
|
|
|
|
|
|
|
As you can see above, the method signature actually _infer_ which even type it listens to. This |
|
|
|
As you can see above, the method signature once again declares the event type it listens to, |
|
|
|
also works for nested generics as long as the actual event resolves the generics parameter you |
|
|
|
but this time with a flexible name and without implementing a specific listener interface. |
|
|
|
would filter on. |
|
|
|
The event type can also be narrowed through generics as long as the actual event type |
|
|
|
|
|
|
|
resolves your generic parameter in its implementation hierarchy. |
|
|
|
|
|
|
|
|
|
|
|
If your method should listen to several events or if you want to define it with no |
|
|
|
If your method should listen to several events or if you want to define it with no |
|
|
|
parameter at all, the event type(s) can also be specified on the annotation itself: |
|
|
|
parameter at all, the event type(s) can also be specified on the annotation itself: |
|
|
|
@ -8408,7 +8409,7 @@ parameter at all, the event type(s) can also be specified on the annotation itse |
|
|
|
---- |
|
|
|
---- |
|
|
|
@EventListener({ContextStartedEvent.class, ContextRefreshedEvent.class}) |
|
|
|
@EventListener({ContextStartedEvent.class, ContextRefreshedEvent.class}) |
|
|
|
public void handleContextStart() { |
|
|
|
public void handleContextStart() { |
|
|
|
|
|
|
|
... |
|
|
|
} |
|
|
|
} |
|
|
|
---- |
|
|
|
---- |
|
|
|
|
|
|
|
|
|
|
|
@ -8658,7 +8659,7 @@ platform's JMX server - all through Spring's standard transaction management and |
|
|
|
and JMX support facilities. Application components can also interact with the |
|
|
|
and JMX support facilities. Application components can also interact with the |
|
|
|
application server's JCA WorkManager through Spring's `TaskExecutor` abstraction. |
|
|
|
application server's JCA WorkManager through Spring's `TaskExecutor` abstraction. |
|
|
|
|
|
|
|
|
|
|
|
Check out the JavaDoc of the |
|
|
|
Check out the javadoc of the |
|
|
|
{api-spring-framework}/jca/context/SpringContextResourceAdapter.html[`SpringContextResourceAdapter`] |
|
|
|
{api-spring-framework}/jca/context/SpringContextResourceAdapter.html[`SpringContextResourceAdapter`] |
|
|
|
class for the configuration details involved in RAR deployment. |
|
|
|
class for the configuration details involved in RAR deployment. |
|
|
|
|
|
|
|
|
|
|
|
@ -8666,7 +8667,7 @@ __For a simple deployment of a Spring ApplicationContext as a Java EE RAR file:_ |
|
|
|
all application classes into a RAR file, which is a standard JAR file with a different |
|
|
|
all application classes into a RAR file, which is a standard JAR file with a different |
|
|
|
file extension. Add all required library JARs into the root of the RAR archive. Add a |
|
|
|
file extension. Add all required library JARs into the root of the RAR archive. Add a |
|
|
|
"META-INF/ra.xml" deployment descriptor (as shown in ``SpringContextResourceAdapter``s |
|
|
|
"META-INF/ra.xml" deployment descriptor (as shown in ``SpringContextResourceAdapter``s |
|
|
|
JavaDoc) and the corresponding Spring XML bean definition file(s) (typically |
|
|
|
javadoc) and the corresponding Spring XML bean definition file(s) (typically |
|
|
|
"META-INF/applicationContext.xml"), and drop the resulting RAR file into your |
|
|
|
"META-INF/applicationContext.xml"), and drop the resulting RAR file into your |
|
|
|
application server's deployment directory. |
|
|
|
application server's deployment directory. |
|
|
|
|
|
|
|
|
|
|
|
|