-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible Bug: What is the consistent approach to load/apply or not the active profiles from the application.properties
file?
#1086
Comments
Once you edit |
Thanks for the reply. In 2 weeks I should do this upgrade and return the respective feedback, it because right now I am with a project on hands and I want have all stable and running as so far. Thanks for your understanding |
Hello
No, I don't use that, normally I use the terminal with some scripts to execute for example the
This weekend should be tested. Let me know if there is a beta version to test it (if is the case) otherwise I am going to use the latest release Thanks for your understanding |
Okay, I see, then run your build with |
I think is better try with the same approach applied, only with the IDE, first with
Yes, I already have that option enabled.
Agree, that's why I have the |
For the |
Looks like we forgot to close this issue here, doing that now. Thanks for the feedback and glad to hear that this is working since the |
For
For a
Spring Boot
project created through https://start.spring.io/ as:spring-boot-project-a
Maven
If is accomplished the following:
@Bean
,@Service
.... etcapplication.properties
file is edited withspring.profiles.active=h2,cache,exception-non
Scenario Alpha
If the app is executed - as the first time - through:
spring-boot-project-a
-> Right Click ->Run As
->Spring Boot App
The app fails at startup because the active profiles defined through the
spring.profiles.active
property in theapplication.properties
file were not applied and many@Autowired
failed due missing dependencies because they were not created due the missing activation of the profiles.The solution is arrive through:
Run
->Run Configurations...
->Spring Boot App
->spring-boot-project-a - SpringBoot...Application
And apply one of the two possible following options within the current dialog window opened according with the previous step:
Spring Boot
tab -> Profile text field:h2,cache,exception-non
->Apply
button ->Run
buttonArguments
tab -> VM arguments: text area: add below of the current value-Dspring.profiles.active=h2,cache,exception-non
->Apply
button ->Run
buttonTherefore through either
Spring Boot
orArguments
tab the app runs in peace because now the active profiles were applied.Question 1
application.properties
file which contains the active profiles throughspring.profiles.active
?Scenario Beta
Once fixed (or applied Scenario Alpha) if later the app is executed through:
Boot Dashboard
view -> Select thespring-boot-project-a
project -> Execute(Re)start
as either Top Menu of the view itself or right clickThe app works as expected and here exists the obvious assumption that the
Boot Dashboard
view reused thespring-boot-project-a - SpringBoot...Application
defined onSpring Boot App
with the current settings defined through eitherSpring Boot
orArguments
tab but...The
Boot Dashboard
view is not really reusing thespring-boot-project-a - SpringBoot...Application
with the current settings where the active profiles was defined. So, is really using theapplication.properties
file.application.properties
file is used?Well, through the
Boot Dashboard
view was executed thespring-boot-project-b
project - other project created and imported in the same way as the firstspring-boot-project-a
project - where it has its ownapplication.properties
file with its ownspring.profiles.active
property and of course its own Beans - and it worked without any problem.And yes, at
Run Configurations
->Spring Boot App
was createdspring-boot-project-b - SpringBoot...Application
, it because it was the first execution. Furthermore was confirmed that theSpring Boot
andArguments
tabs does not have editions/declaration about the active profilesTherefore assuming that:
Boot Dashboard
view ->spring-boot-project-b
->(Re)start
Run
->Run History
->spring-boot-project-b
->SpringBoot...Application
Are both the same and the former executes behind the scene the latter, therefore was expected an error at startup as Scenario Alpha due the missing profiles. But I did not happen.
Question 2
application.properties
file which contains the active profiles throughspring.profiles.active
?Scenario Delta
If
spring-boot-project-a - SpringBoot...Application
andspring-boot-project-b - SpringBoot...Application
are deleted fromSpring Boot App
of theRun Configurations
dialog window and thenspring-boot-project-a - SpringBoot...Application
is re-created again through:spring-boot-project-a
-> Right Click ->Run As
->Spring Boot App
The expected error at startup as Scenario Alpha due the missing profiles - it because the
Spring Boot
andArguments
tabs does not have editions/declaration about the active profiles due the re-creation - did not happen!!!Question 3
From the Beginning...
Even more, if the
spring-boot-project-a
project is deleted and imported as from the beginning therefore Scenario Alpha happens again... it is interesting ...Reason of this Post
application.properties
file?The text was updated successfully, but these errors were encountered: