Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring application.properties values not picket up by MPR Servlet #52

Open
petrixh opened this issue Sep 17, 2019 · 0 comments
Open

Spring application.properties values not picket up by MPR Servlet #52

petrixh opened this issue Sep 17, 2019 · 0 comments

Comments

@petrixh
Copy link

petrixh commented Sep 17, 2019

While working on a MPR migration project, we noticed that the application.properties values are not picked up by the MPRServlet.. Most notably, trying to set the application to production mode left the V8 runtime still in debug mode.

After some investigation a possible cause was found:

AbstractMprServlet#createDeploymentConfiguration(Properties initParameters)

looks for:

com.vaadin.flow.server.VaadinServlet flowServlet = (com.vaadin.flow.server.VaadinServlet)this.getServletContext().getAttribute(com.vaadin.flow.server.VaadinServlet.class.getName());
       if (flowServlet != null) {
           initParameters.setProperty("productionMode", Boolean.toString(flowServlet.getService().getDeploymentConfiguration().isProductionMode()));
       }

But in a spring-boot environment, the servlet is under a different key or loaded at a different time.

A bit of pre-debugging indicates that at the point where the MPR deployment configs are read, none of the entries in the ServletContext is an instance of com.vaadin.flow.server.VaadinServlet

Workaround for production mode (but not all application.properties settings) is to set the following System property:

com.vaadin.mpr.productionMode=true

So for instance:

java -jar -Dcom.vaadin.mpr.productionMode=true xxxx.war

Observed with:
Vaadin 14.0.2
MPR 2.0.0

@caalador caalador added the bug Something isn't working label Feb 5, 2020
@caalador caalador moved this from Needs triage to P2 - Medium Priority in OLD Vaadin Flow bugs & maintenance (Vaadin 10+) Feb 5, 2020
@jm-ferreira jm-ferreira self-assigned this Jun 4, 2020
@jm-ferreira jm-ferreira moved this from P2 - Medium Priority to WIP in OLD Vaadin Flow bugs & maintenance (Vaadin 10+) Jun 4, 2020
@jm-ferreira jm-ferreira moved this from WIP to P2 - Medium Priority in OLD Vaadin Flow bugs & maintenance (Vaadin 10+) Jun 5, 2020
@jm-ferreira jm-ferreira removed their assignment Jun 5, 2020
@pleku pleku moved this from P2 - Medium Priority to New P2 in OLD Vaadin Flow bugs & maintenance (Vaadin 10+) Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🔖 Normal Priority (P2)
Development

No branches or pull requests

3 participants