日常踩坑(2):Spring Boot整合WebSocket遇到的一个坑

遇到这个坑的原因是因为使用 的容器不同 
一种是使用spring boot本身自带的tomcat容器,坑都是在这种方式中., 
另外一种是排除掉spring boot 自带的tomcat容器,使用外置的tomcat.这种方式基本上没什么问题. 
坑一:

socketJQ.js:101 Failed to load http://10.2.52.73:9090/checkUsernameAppType?appType=AT1505728361851: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:63342' is therefore not allowed access.
ajax @ socketJQ.js:101
window.onload @ socketJQ.js:11
load (async)
(anonymous) @ socketJQ.js:4
socketJQ.js:101 Uncaught DOMException: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://10.2.52.73:9090/checkUsernameAppType?appType=AT1505728361851'.
    at ajax (http://fushengruomengzhang_admin.gitee.io/jsandcss/WebSocket/socketJQ.js:101:13)
    at window.onload (http://fushengruomengzhang_admin.gitee.io/jsandcss/WebSocket/socketJQ.js:11:5)
发布了22 篇原创文章 · 获赞 6 · 访问量 4882

猜你喜欢

转载自blog.csdn.net/qq_37651252/article/details/100123657