如何将 Spring Loaded 与 Vaadin TouchKit 应用程序结合使用?

How to combine Spring Loaded with a Vaadin TouchKit application?

我成功地将以下示例(简单的 Spring web 应用程序)获取到 运行: https://www.youtube.com/watch?v=GTrNkhVnJBU

现在我想使用 Spring 加载到基于 Spring Boot 和 Vaadin TouchKit 的项目中。

当我进行更改时(例如 ComboBox 的新标题),Spring Loaded 似乎可以识别它:

2015-09-03 10:23:08.823  INFO 1956 --- [Loader@799dbc3b] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2015-09-03 10:23:08.823  INFO 1956 --- [Loader@799dbc3b] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
2015-09-03 10:23:08.831  INFO 1956 --- [Loader@799dbc3b] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2015-09-03 10:23:08.831  INFO 1956 --- [Loader@799dbc3b] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
2015-09-03 10:23:08.842  INFO 1956 --- [Loader@799dbc3b] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2015-09-03 10:23:08.843  INFO 1956 --- [Loader@799dbc3b] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
2015-09-03 10:23:08.870  INFO 1956 --- [Loader@799dbc3b] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2015-09-03 10:23:08.870  INFO 1956 --- [Loader@799dbc3b] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)

但是按 F5 刷新浏览器后,我没有看到变化(ComboBox 的标题与以前相同)。

我错过了什么吗?在 Spring Loaded 与 Vaadin TouchKit 一起工作之前,我还需要做其他事情吗?

感谢阅读以及您可能提前获得的任何提示!

编辑:

当我在简单的 Spring Web 应用程序示例中进行更改时,我得到以下日志输出:

2015-09-03 10:51:06.503  INFO 8388 --- [Loader@14dad5dc] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto java.lang.String ???.???.tests.springloaded.SpringLoadedController.home()
2015-09-03 10:51:06.504  INFO 8388 --- [Loader@14dad5dc] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2015-09-03 10:51:06.504  INFO 8388 --- [Loader@14dad5dc] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)

所以上下文“/”似乎在那里更新了,但在 TouchKit 应用程序中没有更新。

我使用 Spring Boot + Spring Loaded + Vaadin 在 https://github.com/Artur-/spring-boot-loaded-vaadin

创建了一个简单的示例项目

运行 它使用 mvn install spring-boot:运行 并且您可以更改 UI class 并在刷新后查看更改。

我看不出 TouchKit 会改变什么,除非你的 UI class 上有 @PreserveOnRefresh。在这种情况下,除了刷新之外,您还需要强制创建新的 UI 实例,方法是将 ?restartApplication 添加到 URL.