Wednesday, 15 April 2015

java - Constructing SimpMessagingTemplate instance without autowired -



java - Constructing SimpMessagingTemplate instance without autowired -

i trying send asynchronous messages server client after client connected, independent of user action. examples have found far have simpmessagingtemplate autowired in controller. there file contains info how object gets autowired default? goal utilize object in class not managed spring. prefer have straight forwards way build object, instead of trying recreate deep object perchance circular references through debug mode.

here relevant part of servlet xml:

<websocket:message-broker application-destination-prefix="/socketprefix"> <websocket:stomp-endpoint path="/stompendpoint"> <websocket:sockjs/> </websocket:stomp-endpoint> <websocket:simple-broker prefix="/topics/,/queues/"/> </websocket:message-broker>

that template autowired, because 1 created matches configuration. is, design, coupled other parts of simp infrastructure (and has be!), because build 1 need:

the user destination prefix (if configured custom one) and more important, messagechannel send messages message broker

maybe expand on why class can't spring managed?

see simpmessagingtemplate javadoc.

java spring-websocket

No comments:

Post a Comment