1

I'm using spring boot with vaadin. How should I serve VAADIN folder? I deploy to production using gradle distZip task, which creates a lib and a bin folder. I don't want to include VAADIN folder into the jar because it disables caching and makes a fat jar.

Where should I place the folder, what modifications must be done to serve it from a directory, and not the jar itself?

acsadam0404
  • 2,711
  • 1
  • 26
  • 36
  • Similar Question: [*How to add static resources to vaadin*](https://stackoverflow.com/q/24364251/642706) – Basil Bourque Jul 10 '18 at 04:48
  • **UPDATE** Some major changes on this topic with [Vaadin 10 Flow](https://vaadin.com/flow). See this 2018-07 Vaadin.com blog post by Leif Åstrand, [*Vaadin 10 and static resources*](https://vaadin.com/blog/vaadin-10-and-static-resources) for some great explanation of the old way and new way of placing static resources, and how the *Servlet 2* and *Servlet 3* specs relate. – Basil Bourque Jul 10 '18 at 04:49
  • Possible duplicate of [How to serve static resources from a Vaadin/Spring application?](https://stackoverflow.com/questions/9292439/how-to-serve-static-resources-from-a-vaadin-spring-application) – Basil Bourque Jul 10 '18 at 04:51

1 Answers1

1

I don't know if this fits your needs but your resources can be outsourced to a CDN provider or to your own server or servlet that is better optimized to serve static content.

@WebServlet( value = "/*",  initParams = @WebInitParam( name = "Resources", 
                 value = "http://your-cdn.provider.com/cdn-example" ) )

See this article for further details.

Tobi
  • 2,001
  • 2
  • 27
  • 49