I have a Spring boot web application. The application is configured using java classes using the @Configurable annotation. I entered two profiles: "install", "normal". If the installation profile is active, none of the Beans that require a DB connection are loaded. I want to create a controller in which the user can configure db connection parameters. When this is done, I want to switch the active profile from "install" to "normal" and update the application context, so Spring can initialize every bean that needs a database data source.
I can change the list of active profiles from code without problems, but when I try to update the application context, I get the following exception :
`java.lang.IllegalStateException: GenericApplicationContext does not support multiple refresh attempts: just call 'refresh' once`
This is how I download the Spring boot application:
`new SpringApplicationBuilder().sources(MyApp.class) .profiles("my-profile").build().run(args);`
Does anyone know how to run Spring's download application that allows you to update the application context several times?
java spring-boot spring-profiles refresh applicationcontext
Sawo
source share