javaspring-bootvaadinspring-loadedvaadin-touchkit

How to combine Spring Loaded with a Vaadin TouchKit application?


I successfully got the following example (simple Spring web application) to run: https://www.youtube.com/watch?v=GTrNkhVnJBU

Now I want to use Spring Loaded in a project which is based on Spring Boot and Vaadin TouchKit.

When I make a change (new caption for a ComboBox for example), Spring Loaded seems to recognize it:

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)

But after refreshing my browser by pressing F5, I don't see the change (the caption of the ComboBox stays the same as before).

Am I missing something? Do I have to do anything else before Spring Loaded works with Vaadin TouchKit?

Thanks for reading and any hints you might have in advance!

Edit:

When I make a change in the simple Spring web application example, I get the following log output:

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)

So the context "/" seems to be updated there, but not in the TouchKit application.


Solution

  • I created a simple example project with Spring Boot + Spring Loaded + Vaadin at https://github.com/Artur-/spring-boot-loaded-vaadin

    Running it using mvn install spring-boot:run and you can change the UI class and see changes after a refresh.

    I can't see what TouchKit would change, except if you have @PreserveOnRefresh on your UI class. In that case you would need to force creation of a new UI instance in addition to refresh, by adding ?restartApplication to the URL.