我试图将我的项目置于生产模式,但没有运气:(
启动日志中的一切似乎都很好:
2017-01-09 09:26:24.453 INFO 80996 --- [ main] c.v.s.b.i.VaadinServletConfiguration : Registering Vaadin servlet
2017-01-09 09:26:24.453 INFO 80996 --- [ main] c.v.s.b.i.VaadinServletConfiguration : Servlet will be mapped to URLs [/vaadinServlet/*, /VAADIN/*]
2017-01-09 09:26:24.469 INFO 80996 --- [ main] c.v.s.b.i.VaadinServletConfiguration : Setting servlet init parameters
2017-01-09 09:26:24.469 INFO 80996 --- [ main] c.v.s.b.i.VaadinServletConfiguration : Set servlet init parameter [productionMode] = [true]
2017-01-09 09:26:24.470 INFO 80996 --- [ main] c.v.s.b.i.VaadinServletConfiguration : Set servlet init parameter [resourceCacheTime] = [3600]
2017-01-09 09:26:24.470 INFO 80996 --- [ main] c.v.s.b.i.VaadinServletConfiguration : Set servlet init parameter [heartbeatInterval] = [60]
2017-01-09 09:26:24.470 INFO 80996 --- [ main] c.v.s.b.i.VaadinServletConfiguration : Set servlet init parameter [closeIdleSessions] = [true]
2017-01-09 09:26:26.260 INFO 80996 --- [ main] c.v.s.b.i.VaadinServletConfiguration : Checking the application context for Vaadin UI mappings
2017-01-09 09:26:26.263 INFO 80996 --- [ main] c.v.s.b.i.VaadinServletConfiguration : Registering Vaadin servlet of type [com.vaadin.spring.server.SpringVaadinServlet]
2017-01-09 09:26:26.273 INFO 80996 --- [ main] c.v.s.b.i.VaadinServletConfiguration : Forwarding @SpringUI URLs from {/admin/*=org.springframework.web.servlet.mvc.ServletForwardingController@6fc3f1a7, /pages/*=org.springframework.web.servlet.mvc.ServletForwardingController@6fc3f1a7, /dashboard/*=org.springframework.web.servlet.mvc.ServletForwardingController@6fc3f1a7, /admin/*/=org.springframework.web.servlet.mvc.ServletForwardingController@6fc3f1a7, /dashboard/*/=org.springframework.web.servlet.mvc.ServletForwardingController@6fc3f1a7, /pages/*/=org.springframework.web.servlet.mvc.ServletForwardingController@6fc3f1a7}
2017-01-09 09:26:26.283 INFO 80996 --- [ main] c.v.spring.navigator.SpringViewProvider : Looking up SpringViews
2017-01-09 09:26:26.288 INFO 80996 --- [ main] c.v.spring.navigator.SpringViewProvider : 18 SpringViews found
2017-01-09 09:26:26.858 INFO 80996 --- [ main] com.web.Application : Started Application in 26.671 seconds (JVM running for 27.124)
但是当我访问我的应用程序时:
2017-01-09 09:26:32.916 WARN 80996 --- [ XNIO-2 task-1] c.v.s.DefaultDeploymentConfiguration :
=================================================================
Vaadin is running in DEBUG MODE.
Add productionMode=true to web.xml to disable debug features.
To show debug window, add ?debug to your application URL.
=================================================================
2017-01-09 09:26:35.613 INFO 80996 --- [ XNIO-2 task-2] c.vaadin.spring.server.SpringUIProvider : Checking the application context for Vaadin UIs
2017-01-09 09:26:35.615 INFO 80996 --- [ XNIO-2 task-2] c.vaadin.spring.server.SpringUIProvider : Found Vaadin UI [com.web.ui.AdminUI]
2017-01-09 09:26:35.616 INFO 80996 --- [ XNIO-2 task-2] c.vaadin.spring.server.SpringUIProvider : Found Vaadin UI [com.web.ui.DashboardUI]
2017-01-09 09:26:35.616 INFO 80996 --- [ XNIO-2 task-2] c.vaadin.spring.server.SpringUIProvider : Found Vaadin UI [com.web.ui.PagesUI]
2017-01-09 09:26:35.616 WARN 80996 --- [ XNIO-2 task-2] c.vaadin.spring.server.SpringUIProvider : Found no Vaadin UIs in the application context
2017-01-09 09:26:36.737 INFO 80996 --- [ XNIO-2 task-8] c.vaadin.spring.server.SpringUIProvider : Checking the application context for Vaadin UIs
2017-01-09 09:26:36.740 INFO 80996 --- [ XNIO-2 task-8] c.vaadin.spring.server.SpringUIProvider : Found Vaadin UI [com.web.ui.AdminUI]
2017-01-09 09:26:36.740 INFO 80996 --- [ XNIO-2 task-8] c.vaadin.spring.server.SpringUIProvider : Found Vaadin UI [com.web.ui.DashboardUI]
2017-01-09 09:26:36.740 INFO 80996 --- [ XNIO-2 task-8] c.vaadin.spring.server.SpringUIProvider : Found Vaadin UI [com.web.ui.PagesUI]
2017-01-09 09:26:36.740 WARN 80996 --- [ XNIO-2 task-8] c.vaadin.spring.server.SpringUIProvider : Found no Vaadin UIs in the application context
我使用自定义servlet进行vaadin,如果我发表评论(并使用vaadin spring boot auto config提供的默认值),则不会出现DEBUG信息......
@Bean(name = "springBootServletRegistrationBean")
public ServletRegistrationBean servletRegistrationBean() {
SpringVaadinServlet servlet = new SpringVaadinServlet() {
@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration) throws ServiceException {
SpringVaadinServletService service = new SpringVaadinServletService(this, deploymentConfiguration, null) {
...
有人知道我做错了吗?
答案 0 :(得分:2)
尝试将vaadin.servlet.productionMode=true
添加到您的属性文件中。所有其他属性都可以在课堂上看到:com.vaadin.spring.boot.internal.VaadinServletConfigurationProperties
此外,您应该使用以下结构,而不是使用ServletRegistrationBean
进行自定义VaadinServlet
:
@Bean
public VaadinServlet vaadinServlet(){
return new SpringVaadinServlet(){
@Override
protected VaadinServletService createServletService(DeploymentConfiguration deploymentConfiguration) throws ServiceException {
SpringVaadinServletService servletService = new SpringVaadinServletService(this, deploymentConfiguration, getServiceUrlPath()) {
// Override any custom method here
}
}
};
}