How to set active profile in spring boot application. This application will be deployed in standalone Tomcat.
I have 2 application- {profile} .properties properties files.
My application class
@SpringBootApplication public class Application extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } public static void main(String[] args) { System.setProperty(AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME, "dev"); ApplicationContext ctx = SpringApplication.run(Application.class, args); } }
if I run the application with built-in tomcat, the dev profile is set as active and it works fine. But when I turn around in a solitary cat. This does not work.
I tried to set the active profile in the configure method. but I get a null pointer exception when I get the environment out of context.
Any help on setting up an active profile.
Mukun source share