Could not autowire. No beans of SimpMessagingTemplate type found

后端 未结 4 962
自闭症患者
自闭症患者 2020-12-31 03:09

I am configuring Websockets in Spring basically by following the guide provided in the documentation.

I am currently trying to send a message from the server to the

4条回答
  •  北海茫月
    2020-12-31 03:31

    Rossen was correct. The addition of the element will add the SimpMessagingTemplate bean to the context for injection. This has to be in the web app root context, not the context for Spring DispatchServlet. E.g., in the following web.xml file, the message-broker element should be included in app-root.xml file. Including only in app-mvc.xml will cause NoSuchBeanDefinitionException.

    
    contextConfigLocation
    classpath:/spring/app-root.xml
    
    
    
    Spring MVC Dispatcher Servlet
    org.springframework.web.servlet.DispatcherServlet
    
        contextConfigLocation
        classpath:/spring/app-mvc.xml
    
    1
    
    

提交回复
热议问题