Skip to content
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

Eclipse Spring Tools Sometimes Doesn't Honor Profile or any Override Properties #1432

Closed
cabbonizio opened this issue Dec 6, 2024 · 6 comments
Labels

Comments

@cabbonizio
Copy link

Describe the bug
Using Spring Tool Suite 4 for Eclipse - 4.27.0.202411281623

To Reproduce
There are some spring boot projects, all of the same version.......now the newly released 3.4.0 where the profile is not honored nor any of the override properties. The application simply starts up as "default" profile and fails to start up. I can't figure out what is different between one project vs. the next as they are all based on the same parent project.

image

In the above project, it's based on Spring Boot 3.4.0 and when I start it up the profile nor override properties are honored. I have another project with the same settings and it honors both the profile and override properties.

@BoykoAlex
Copy link
Contributor

@cabbonizio Unfortunately I wasn't able to reproduce this with something simple like PetClinic project... Do you mind attaching some trimmed down sample project? Thanks in advance!-)

@martinlippert martinlippert added status: waiting-for-feedback for: eclipse something that is specific for Eclipse and removed status: waiting-for-triage labels Dec 6, 2024
@martinlippert martinlippert removed this from the 4.28.0.RELEASE milestone Dec 6, 2024
@cabbonizio
Copy link
Author

I'm comparing the dependencies right now to see if there's something maybe on the classpath that's causing this issue:

image

And the one that does work:

image

@cabbonizio
Copy link
Author

@BoykoAlex I figured it out...........this one very popular line in Spring Boot apps. This is usually a line we don't pay attention to but it's been right under our nose all along. Newer apps using the DevTools to create project do it properly with the "args" param.......some of our older apps may be been more hand typed with adding "args" being an afterthought. If this is working as designed you can close this. Many thanks for having a look at this.

Service that does not work:
SpringApplication.run(Application.class);

Service that does work:
SpringApplication.run(Application.class, args);

@martinlippert
Copy link
Member

@cabbonizio Thanks a lot for the update and great that you found the issue here. The launch configuration indeed turns the selected profiles into a command line arg like --spring.profiles.active=prof, which only makes it into the application if you pass on the args parameter to the SpringApplication.run method. So we could say that this "works as designed".

But we could (and maybe should) change the way the launch configuration turns those settings into arguments for the application and switch this over to set system properties instead - which would make it into the application independent of the exact way you implement the main method.

@BoykoAlex What do you think?

@BoykoAlex
Copy link
Contributor

Yes, we could turn these into system properties... I cannot think of an argument against that so I'll give it a try.

@BoykoAlex
Copy link
Contributor

BoykoAlex commented Jan 16, 2025

Fixed via 05cb65e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants