If I define one of the server.ssl properties in the application.properties, it also effects the production profile.
I'm definitely using the production profile, as it uses all other values from application-production.properties
Specific example:
application.properties:
server.port=443
server.ssl.key-store=classpath:perf02-ssl.p12
server.ssl.key-store-password=changeit
server.ssl.key-store-type=PKCS12
server.ssl.key-alias=perf02
application-production.properties:
server.port=8080
Tomcat logs (with properties defined in application.properties):
2018-11-27 11:45:50.944 INFO 1 --- [main] c.c.r.ReportbookletApplication : The following profiles are active: production
2018-11-27 11:45:54.020 INFO 1 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (https)
2018-11-27 11:45:54.054 INFO 1 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-11-27 11:45:54.054 INFO 1 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.12
Tomcat logs (without properties defined in application.properties):
2018-11-27 11:52:58.012 INFO 1 --- [main] c.c.r.ReportbookletApplication : The following profiles are active: production
2018-11-27 11:53:01.145 INFO 1 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2018-11-27 11:53:01.207 INFO 1 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-11-27 11:53:01.208 INFO 1 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.12
Comment From: wilkinsona
The behaviour you have described is expected. application.properties
is not a profile-specific configuration file so its configuration applies irrespective of which profiles are active. Where the same property is defined in both application.properties
and a profile-specific configuration file, the profile-specific configuration will take precedence for that property. You can see this in your example above where server.port=8080
from application-production.properties
is overriding server.port=443
from application.properties
.
If the SSL-related configuration that is currently in application.properties
is specific to a particular environment, I would recommend moving them into a profile-specific configuration file and activating that profile.
Comment From: ugurayanblume
Whay closed! Whats the solution ?
Comment From: wilkinsona
@ugurayanblume As I said above:
If the SSL-related configuration that is currently in application.properties is specific to a particular environment, I would recommend moving them into a profile-specific configuration file and activating that profile.
If you have any further questions, please follow up on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.