I am trying to run Spring Boot as a service using init.d. I face an issue that -Dspring.profiles.active=xxx is not being consider and spring says no active profiles found setting profile as default.
I am using SpringBoot version 1.5.13.
The below are my conf file settings
JAVA_OPTS="-Xms2048m -Xmx2048m -XX:+UseG1GC -XX:+UseStringDeduplication -Djsse.enableSNIExtension=false -Djava.security.egd=file:/dev/./urandom"
MODE=service
RUN_ARGS=-Dspring.profiles.active=myprofile
I even tried setting the environment variables RUN_ARGS but still the service does not pick it up.
My conf file is located in a different folder compared to my jar file and I have used the bootRepackage in my gradle build to point to the location(sample as below)
bootRepackage {
mainClass = 'com.test.myapp.MyAppApplication'
executable = true
embeddedLaunchScriptProperties =
[
'mode': 'service',
'confFolder': '/etc/myapp/conf'
]
excludeDevtools = true
}
The name of my bootJar and the name of the conf file is same. Also I see the confFolder specified is taken correctly inside of the bootJar when I do a head -100 myapp.jar
I have used ospackage to bundle my spring boot application as a rpm and then I deploy it using yum install and start the service.
I am not sure what I am missing. Any help would be much appreciated.