这里就不说搭建和代码,从网上搜就有我这里只写遇到的错误,避免各位朋友继续在坑里。
参考这个可以搭建一套websocket前后台。https://www.cnblogs.com/bianzy/p/5822426.html
直接说问题吧!
图片:
这是前台和后台写好之后前台访问结果出现404,在网上搜到的都是在pom文件中引入jar包
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
再写一个WebSocketConfig 配置。如下:
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
@Configuration
public class WebSocketConfig {
@Bean
public ServerEndpointExporter serverEndpointExpor