[英]Springboot, Vaadin and RestController
I created a new project with spring boot that includes vaadin and springmvc. 我用Spring引导创建了一个包含vaadin和springmvc的新项目。
I added a restcontroller class and a vaadin view class annotated with @Route
, yet when trying to access the view I receive a blank pages and a lot of failed http request with 405 access code to /VAADIN
and /frontend
paths. 我添加了一个restcontroller类和一个用
@Route
注释的vaadin视图类,但是当我尝试访问视图时,我收到一个空白页面和大量失败的http请求,其中405访问代码到/VAADIN
和/frontend
路径。
When removing the restcontroller, the vaadin view worked. 删除rest控制器时,vaadin视图有效。
The solution was adding a servlet mapping to the vaadin resources: 解决方案是向vaadin资源添加servlet映射:
@WebServlet(
urlPatterns = {
"/VAADIN/*", "/frontend/*"
},
initParams = {
@WebInitParam(name = "productionMode", value = "false")
})
public class MyServlet extends VaadinServlet {}
Don't forget to add @ServletComponentScan
annotation. 不要忘记添加
@ServletComponentScan
注释。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.