Dolphin的博客


  • 首页

  • 分类

  • 关于

  • 归档

  • 标签

  • Sitemap

  • 搜索
close
Dolphin的博客

Stomp WebSocket路由

发表于 2016-10-20 | 分类于 Programming |

STOMP即Simple (or Streaming) Text Orientated Messaging Protocol,简单(流)文本定向消息协议,它提供了一个可互操作的连接格式,允许STOMP客户端与任意STOMP消息代理(Broker)进行交互。STOMP协议由于设计简单,易于开发客户端,因此在多种语言和多种平台上得到广泛地应用。WebSocket协议的应用层子协议STOMP(流文本定向消息协议)。在应用中直接使用WebSocket API显得有些低端,直到统一标准规范时也只有一小部分框架可以解析信息或通过注解方式使用它。这正是考虑在应用中运用子协议和产生基于WebSocket支持的Spring的STOMP的原因。当运用一个上层协议,WebSocket API的细节就显得不那么重要了,正如运用了HTTP后TCP的通信细节不再暴漏在应用中一样。STOMP是为了简单而创建的一种消息协议。它基于模仿HTTP协议的帧。帧由一个命令、可选的头和可选的体组成。

阅读全文 »
Dolphin的博客

expected single matching bean but found 2

发表于 2016-10-20 | 分类于 Programming |

在WebSocket往客户端推送消息的开发过程中,获取推送消息实例SimpMessagingTemplate时,错误如下:

1
[ERROR]-[2016年-10月-19日17:53:25.026]-[RMI TCP Connection(2)-127.0.0.1]-[org.springframework.web.context.ContextLoader]-{Context initialization failed} org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name  'com.zw.socket.service.controller.InstanceMessageController#0' defined in class path resource [spring-config/spring-socket-servlet.xml]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.messaging.simp.SimpMessagingTemplate] is defined: expected single matching bean but found 2:org.springframework.messaging.simp.SimpMessagingTemplate#0,brokerMessagingTemplate
阅读全文 »
Dolphin的博客

Spring Bean是否注册判断

发表于 2016-10-18 | 分类于 Programming |

在项目的开发过程中有许多Bean,怎么判断一个Bean是否已经纳入容器管理了呢?当然最直接的方式是直接使用,如果不能用,那么肯定就未注册成功,但是也有的情况不是那么明显的,即使没有注册成功也不会有明显的错误。如何有效的鉴别和判断是否已经注册?

阅读全文 »
Dolphin的博客

Spring线程中Bean注入问题

发表于 2016-10-18 | 分类于 Programming |

实现ApplicationContextAware

在Spring中开启线程时,无法使用Bean的自动注入,此时需要手动获取Bean。方法如下:

阅读全文 »
Dolphin的博客

port aready in use

发表于 2016-10-17 | 分类于 Programming |

在使用Intellij Idea调试时,以Application方式启动程序时提示:

1
2
3
4
5
6
7
8
9
10
11
12
13
2016-10-17 11:28:38.537 ERROR 23156 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.

Action:

Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.
阅读全文 »
<i class="fa fa-angle-left"></i>1…333435…41<i class="fa fa-angle-right"></i>
xiaoqiang jiang

xiaoqiang jiang

201 日志
18 分类
175 标签
Creative Commons
推荐博客
  • 阮一峰的个人网站
  • 陈皓(CoolShell)
  • 阿里中间件团队博客
  • 小土刀的博客
  • Lucida的博客
  • stormzhang的博客
  • 四火的唠叨
© 2020 xiaoqiang jiang
由 Hexo 强力驱动
主题 - NexT.Muse