问题
I have an existing project in Spring MVC which works as expected without any issues. Iam able to take view pages via controller.
Now i configure spring websocket into this existing project using below code
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.enableSimpleBroker("/topic");
config.setApplicationDestinationPrefixes("/app");
}
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/gs-guide-websocket").withSockJS();
}
}
Maven dependencies added mentioned below
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>4.3.11.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-messaging -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
This is the only thing i have done, after this my app is not working. When i take url-localhost:8080/myapp am not able to see my view. When i comment websocket configuration class everything works fine.
No error in app or server log- Any clue please !?
来源:https://stackoverflow.com/questions/47277160/spring-websocket-in-existing-project-not-working