Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Production Mode in Vaadin Spring-Boot
Hi,
I am trying to activate production Mode in my spring-boot application, but I didn't find any documentation about it. Also I would like to set other parameters, like idle session timeout, etc.
My workaround was to overwrite the parameter in my custom servlet:
https://github.com/datenhahn/ffmobile-map/commit/9b7db70dc12f89c2efc136d397a51fc2d41de2d1
These parameters I would like to overwrite (like with the VaadinServletConfiguration Annotation in "normal" vaadin)
2015-09-26 17:28:03.140 INFO 8488 --- [ost-startStop-1] c.v.s.b.i.VaadinServletConfiguration : Setting servlet init parameters
2015-09-26 17:28:03.140 INFO 8488 --- [ost-startStop-1] c.v.s.b.i.VaadinServletConfiguration : Set servlet init parameter [productionMode] = [false]
2015-09-26 17:28:03.140 INFO 8488 --- [ost-startStop-1] c.v.s.b.i.VaadinServletConfiguration : Set servlet init parameter [resourceCacheTime] = [3600]
2015-09-26 17:28:03.140 INFO 8488 --- [ost-startStop-1] c.v.s.b.i.VaadinServletConfiguration : Set servlet init parameter [heartbeatInterval] = [300]
2015-09-26 17:28:03.140 INFO 8488 --- [ost-startStop-1] c.v.s.b.i.VaadinServletConfiguration : Set servlet init parameter [closeIdleSessions] = [false]
I think that is the way you'll have to do it at the moment - or that's how I've also done it. Personally, I'd like to be able to configure those settings through application properties, would be consistent with other configuration.
If you are using Spring Boot, you can set most (but not all) of the servlet properties by adding them to your application.properties file. You can find the supported properties here. In your case, you'd use:
- vaadin.servlet.resourceCacheTime
- vaadin.servlet.productionMode
- vaadin.servlet.heartbeatInterval
- vaadin.servlet.closeIdleSessions
I created a wiki page for Vaadin Spring tips and added this as a basis. Feel free to add new stuff to that page. These should definitely be in the Book as well, I'll tip Marko about this.
cheers,
matti
Thanks, it worked with the application.properties now. I tried that before, but maybe I used the wrong keys.
Petter Holmström: If you are using Spring Boot, you can set most (but not all) of the servlet properties by adding them to your application.properties file. You can find the supported properties here. In your case, you'd use:
- vaadin.servlet.resourceCacheTime
- vaadin.servlet.productionMode
- vaadin.servlet.heartbeatInterval
- vaadin.servlet.closeIdleSessions
Thank you for the writeup and also maati for adding this to the Vaadin Spring tips Wiki entry. Valuable information.
I tried
#vaadin.servlet.resourceCacheTime
vaadin.servlet.productionMode=true
#vaadin.servlet.heartbeatInterval
vaadin.servlet.closeIdleSessions=true;
and it seems I am still stuck in
Vaadin is running in DEBUG MODE. Add productionMode=true to web.xml to disable debug features. ===========================================================**
all othe rproperites froms ame application.properties are read just fine.... any ideas? I am using
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>2.0.5.RELEASE</version>
</dependency>
and
<vaadin.version>11.0.1</vaadin.version>
<component.version>1.1.0.beta1</component.version>
Use the following in your application.yml to set production mode
vaadin:
productionMode: false
Of course, if you wanted production mode to be enabled, set the value to true
sorry to sound weird but... I am using SpringBoot and I have no idea where an yml file could be... I am using maven and springboot, (yml this looks like gradle? I am not using gradle ) I have tried in application.properties
#vaadin.servlet.resourceCacheTime
vaadin.servlet.productionMode=true
#vaadin.servlet.heartbeatInterval
vaadin.servlet.closeIdleSessions=true;
in vain
I passed it OK on java cmd line -Dvaadin.productionMode=true
problem solved
peter voland: sorry to sound weird but... I am using SpringBoot and I have no idea where an yml file could be... I am using maven and springboot, (yml this looks like gradle? I am not using gradle ) I have tried in application.properties
#vaadin.servlet.resourceCacheTime vaadin.servlet.productionMode=true #vaadin.servlet.heartbeatInterval vaadin.servlet.closeIdleSessions=true;
in vain
application.yml lives in src/main/resources. IDK if one can use both application.properties and application.yml, but I chose to use yml. The two files both serve the same purpose in Spring.
peter voland: sorry to sound weird but... I am using SpringBoot and I have no idea where an yml file could be... I am using maven and springboot, (yml this looks like gradle? I am not using gradle ) I have tried in application.properties
#vaadin.servlet.resourceCacheTime vaadin.servlet.productionMode=true #vaadin.servlet.heartbeatInterval vaadin.servlet.closeIdleSessions=true;
in vain
I got it to work by changing vaadin.servlet.productionMode=true
to vaadin.productionMode=true
I tried everything from this topic to run application in production mode... but all the time I see DEBUG MODE. Any chance for help?
My POM
...
<properties>
<java.version>1.8</java.version>
<vaadin.version>12.0.6</vaadin.version>
</properties>
...
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- Production mode can be activated with either property or profile -->
<id>production-mode</id>
<activation>
<property>
<name>vaadin.productionMode</name>
</property>
</activation>
<properties>
<vaadin.productionMode>true</vaadin.productionMode>
</properties>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-server-production-mode</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<executions>
<execution>
<goals>
<goal>copy-production-files</goal>
<goal>package-for-production</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>-Dvaadin.productionMode</jvmArguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
my application.properties
server.port = 8090
vaadin.servlet.productionMode=true
#vaadin.productionMode=true
vaadin.servlet.heartbeatInterval=60
vaadin.servlet.closeIdleSessions=true
Using java still dont work:
java -jar application.jar -Dvaadin.productionMode=true
Rafal Kozyra: I tried everything from this topic to run application in production mode... but all the time I see DEBUG MODE. Any chance for help?
Try setting
vaadin.productionMode=true
vaadin.heartbeatInterval=60
vaadin.closeIdleSessions=true
in application.properties. Then build with
mvn clean package -Pproduction-mode
strange with
vaadin.productionMode=true
vaadin.heartbeatInterval=60
vaadin.closeIdleSessions=true
works now ... thx