Update WebSocket docs on proxying @Controller
Issue: SPR-13384
This commit is contained in:
@@ -77,6 +77,11 @@ import org.springframework.messaging.Message;
|
||||
* have the message directed to a specific user if connected. The return value is
|
||||
* converted with a {@link org.springframework.messaging.converter.MessageConverter}.
|
||||
*
|
||||
* <p><b>NOTE:</b> When using controller interfaces (e.g. for AOP proxying),
|
||||
* make sure to consistently put <i>all</i> your mapping annotations - such as
|
||||
* {@code @MessageMapping} and {@code @SubscribeMapping} - on
|
||||
* the controller <i>interface</i> rather than on the implementation class.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.0
|
||||
* @see org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler
|
||||
|
||||
@@ -40,6 +40,11 @@ import java.lang.annotation.Target;
|
||||
* user and does not pass through the message broker. This is useful for
|
||||
* implementing a request-reply pattern.
|
||||
*
|
||||
* <p><b>NOTE:</b> When using controller interfaces (e.g. for AOP proxying),
|
||||
* make sure to consistently put <i>all</i> your mapping annotations - such as
|
||||
* {@code @MessageMapping} and {@code @SubscribeMapping} - on
|
||||
* the controller <i>interface</i> rather than on the implementation class.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.0
|
||||
* @see org.springframework.messaging.handler.annotation.MessageMapping
|
||||
|
||||
@@ -1374,6 +1374,19 @@ Or alternatively an `@SubscribeMapping` method can be annotated with `@SendTo`
|
||||
in which case the resulting message is sent to the `"brokerChannel"` using
|
||||
the specified target destination.
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
In some cases a controller may need to be decorated with an AOP proxy at runtime.
|
||||
One example is if you choose to have `@Transactional` annotations directly on the
|
||||
controller. When this is the case, for controllers specifically, we recommend
|
||||
using class-based proxying. This is typically the default choice with controllers.
|
||||
However if a controller must implement an interface that is not a Spring Context
|
||||
callback (e.g. `InitializingBean`, `*Aware`, etc), you may need to explicitly
|
||||
configure class-based proxying. For example with `<tx:annotation-driven />`,
|
||||
change to `<tx:annotation-driven proxy-target-class="true" />`.
|
||||
====
|
||||
|
||||
|
||||
|
||||
[[websocket-stomp-handle-send]]
|
||||
=== Sending Messages
|
||||
|
||||
Reference in New Issue
Block a user