I have a Spring boot Web application. The application is configured via java classes using the @Configurable annotation. I have introduced two profiles: 'install', 'normal'. If the install profile is active, none of the Beans that require DB connection is loaded. I want to create a controller where the user can set up the db connection parameters and When it's done I want to switch the active profile from 'install' to 'normal' and refresh the application context, so the Spring can init every bean that needs DB data source.
I can modify the list of active profiles from code, without problems, but when i try to refresh 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 boot my Spring boot app:
`new SpringApplicationBuilder().sources(MyApp.class)
.profiles("my-profile").build().run(args);`
Does anybody know how to initiate spring boot app that let's you refresh the app context multiple times ?