Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Commit

Permalink
Jmix productionMode property does not affect Vaadin configuration #680
Browse files Browse the repository at this point in the history
  • Loading branch information
Flaurite committed Oct 4, 2021
1 parent c719782 commit 5e54d46
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.vaadin.server.VaadinServlet;
import com.vaadin.spring.annotation.SpringUI;
import com.vaadin.spring.server.SpringVaadinServlet;
import io.jmix.ui.UiProperties;
import io.jmix.ui.sys.vaadin.JmixVaadinServlet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -89,6 +90,8 @@ public class JmixVaadinServletConfiguration implements InitializingBean {
protected ApplicationContext applicationContext;
@Autowired
protected VaadinServletConfigurationProperties configurationProperties;
@Autowired
protected UiProperties uiProperties;

// forward the root of all @SpringUIs to the Vaadin servlet
@Bean
Expand Down Expand Up @@ -282,7 +285,7 @@ protected void addInitParameters(

addInitParameter(servletRegistrationBean,
Constants.SERVLET_PARAMETER_PRODUCTION_MODE,
String.valueOf(configurationProperties.isProductionMode()));
String.valueOf(uiProperties.isProductionMode()));
addInitParameter(servletRegistrationBean,
Constants.SERVLET_PARAMETER_RESOURCE_CACHE_TIME,
String.valueOf(configurationProperties.getResourceCacheTime()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ public class VaadinServletConfigurationProperties {
// special formatting of the field javadoc - see
// http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#configuration-metadata-annotation-processor

/**
* Whether Vaadin is in production mode.
*/
private boolean productionMode = false;

/**
* The time resources can be cached in the browser in seconds (default one
* hour).
Expand Down Expand Up @@ -72,10 +67,6 @@ public class VaadinServletConfigurationProperties {
*/
private String urlMapping = null;

public boolean isProductionMode() {
return productionMode;
}

public int getResourceCacheTime() {
return resourceCacheTime;
}
Expand All @@ -96,10 +87,6 @@ public String getUrlMapping() {
return urlMapping;
}

public void setProductionMode(boolean productionMode) {
this.productionMode = productionMode;
}

public void setResourceCacheTime(int resourceCacheTime) {
this.resourceCacheTime = resourceCacheTime;
}
Expand Down
9 changes: 8 additions & 1 deletion ui/src/main/java/io/jmix/ui/UiProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public class UiProperties {

boolean testMode;
boolean performanceTestMode;

/**
* Whether application is in production mode
*/
boolean productionMode;

/**
Expand Down Expand Up @@ -124,7 +128,7 @@ public class UiProperties {
public UiProperties(
boolean testMode,
boolean performanceTestMode,
@DefaultValue("true") boolean productionMode,
@DefaultValue("false") boolean productionMode,
@DefaultValue("TABBED") String appWindowMode,
@DefaultValue("true") boolean compositeMenu,
@DefaultValue("false") boolean allowAnonymousAccess,
Expand Down Expand Up @@ -236,6 +240,9 @@ public long getWebJarResourcesCacheTime() {
return webJarResourcesCacheTime;
}

/**
* @see #productionMode
*/
public boolean isProductionMode() {
return productionMode;
}
Expand Down

0 comments on commit 5e54d46

Please sign in to comment.