本文整理匯總了Java中org.springframework.messaging.simp.SimpMessagingTemplate.setMessageConverter方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpMessagingTemplate.setMessageConverter方法的具體用法?Java SimpMessagingTemplate.setMessageConverter怎麽用?Java SimpMessagingTemplate.setMessageConverter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.messaging.simp.SimpMessagingTemplate
的用法示例。
在下文中一共展示了SimpMessagingTemplate.setMessageConverter方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setup
import org.springframework.messaging.simp.SimpMessagingTemplate; //導入方法依賴的package包/類
@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
SimpMessagingTemplate messagingTemplate = new SimpMessagingTemplate(this.messageChannel);
messagingTemplate.setMessageConverter(new StringMessageConverter());
this.handler = new SubscriptionMethodReturnValueHandler(messagingTemplate);
SimpMessagingTemplate jsonMessagingTemplate = new SimpMessagingTemplate(this.messageChannel);
jsonMessagingTemplate.setMessageConverter(new MappingJackson2MessageConverter());
this.jsonHandler = new SubscriptionMethodReturnValueHandler(jsonMessagingTemplate);
Method method = this.getClass().getDeclaredMethod("getData");
this.subscribeEventReturnType = new MethodParameter(method, -1);
method = this.getClass().getDeclaredMethod("getDataAndSendTo");
this.subscribeEventSendToReturnType = new MethodParameter(method, -1);
method = this.getClass().getDeclaredMethod("handle");
this.messageMappingReturnType = new MethodParameter(method, -1);
method = this.getClass().getDeclaredMethod("getJsonView");
this.subscribeEventJsonViewReturnType = new MethodParameter(method, -1);
}
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:25,代碼來源:SubscriptionMethodReturnValueHandlerTests.java
示例2: setUp
import org.springframework.messaging.simp.SimpMessagingTemplate; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(this.brokerChannel.send(any())).thenReturn(true);
this.converter = new MappingJackson2MessageConverter();
SimpMessagingTemplate brokerTemplate = new SimpMessagingTemplate(this.brokerChannel);
brokerTemplate.setMessageConverter(this.converter);
this.localRegistry = mock(SimpUserRegistry.class);
this.multiServerRegistry = new MultiServerUserRegistry(this.localRegistry);
this.handler = new UserRegistryMessageHandler(this.multiServerRegistry, brokerTemplate,
"/topic/simp-user-registry", this.taskScheduler);
}
示例3: brokerMessagingTemplate
import org.springframework.messaging.simp.SimpMessagingTemplate; //導入方法依賴的package包/類
@Bean
public SimpMessagingTemplate brokerMessagingTemplate() {
SimpMessagingTemplate template = new SimpMessagingTemplate(brokerChannel());
String prefix = getBrokerRegistry().getUserDestinationPrefix();
if (prefix != null) {
template.setUserDestinationPrefix(prefix);
}
template.setMessageConverter(brokerMessageConverter());
return template;
}
示例4: setup
import org.springframework.messaging.simp.SimpMessagingTemplate; //導入方法依賴的package包/類
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
SimpMessagingTemplate brokerTemplate = new SimpMessagingTemplate(this.channel);
brokerTemplate.setMessageConverter(this.converter);
this.messageHandler = new TestSimpAnnotationMethodMessageHandler(brokerTemplate, this.channel, this.channel);
this.messageHandler.setApplicationContext(new StaticApplicationContext());
this.messageHandler.setValidator(new StringTestValidator(TEST_INVALID_VALUE));
this.messageHandler.afterPropertiesSet();
this.testController = new TestController();
}
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:15,代碼來源:SimpAnnotationMethodMessageHandlerTests.java
示例5: setup
import org.springframework.messaging.simp.SimpMessagingTemplate; //導入方法依賴的package包/類
@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
SimpMessagingTemplate messagingTemplate = new SimpMessagingTemplate(this.messageChannel);
messagingTemplate.setMessageConverter(new StringMessageConverter());
this.handler = new SendToMethodReturnValueHandler(messagingTemplate, true);
this.handlerAnnotationNotRequired = new SendToMethodReturnValueHandler(messagingTemplate, false);
SimpMessagingTemplate jsonMessagingTemplate = new SimpMessagingTemplate(this.messageChannel);
jsonMessagingTemplate.setMessageConverter(new MappingJackson2MessageConverter());
this.jsonHandler = new SendToMethodReturnValueHandler(jsonMessagingTemplate, true);
Method method = this.getClass().getDeclaredMethod("handleNoAnnotations");
this.noAnnotationsReturnType = new SynthesizingMethodParameter(method, -1);
method = this.getClass().getDeclaredMethod("handleAndSendToDefaultDestination");
this.sendToDefaultDestReturnType = new SynthesizingMethodParameter(method, -1);
method = this.getClass().getDeclaredMethod("handleAndSendTo");
this.sendToReturnType = new SynthesizingMethodParameter(method, -1);
method = this.getClass().getDeclaredMethod("handleAndSendToWithPlaceholders");
this.sendToWithPlaceholdersReturnType = new SynthesizingMethodParameter(method, -1);
method = this.getClass().getDeclaredMethod("handleAndSendToUser");
this.sendToUserReturnType = new SynthesizingMethodParameter(method, -1);
method = this.getClass().getDeclaredMethod("handleAndSendToUserSingleSession");
this.sendToUserSingleSessionReturnType = new SynthesizingMethodParameter(method, -1);
method = this.getClass().getDeclaredMethod("handleAndSendToUserDefaultDestination");
this.sendToUserDefaultDestReturnType = new SynthesizingMethodParameter(method, -1);
method = this.getClass().getDeclaredMethod("handleAndSendToUserDefaultDestinationSingleSession");
this.sendToUserSingleSessionDefaultDestReturnType = new SynthesizingMethodParameter(method, -1);
method = this.getClass().getDeclaredMethod("handleAndSendToJsonView");
this.jsonViewReturnType = new SynthesizingMethodParameter(method, -1);
}