Skip to content

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

Closed

Description

@cabbonizio

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.

Activity

  1. added this to the 4.28.0.RELEASE milestone on Dec 6, 2024
  2. BoykoAlex commented on Dec 6, 2024

    @BoykoAlex
    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!-)

  3. removed this from the 4.28.0.RELEASE milestone on Dec 6, 2024
  4. cabbonizio commented on Dec 7, 2024

    @cabbonizio
    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

  5. cabbonizio commented on Dec 7, 2024

    @cabbonizio
    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);

  6. martinlippert commented on Dec 18, 2024

    @martinlippert
    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?

  7. added this to the 4.28.0.RELEASE milestone on Dec 18, 2024
  8. BoykoAlex commented on Jan 16, 2025

    @BoykoAlex
    Contributor

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

  9. BoykoAlex commented on Jan 16, 2025

    @BoykoAlex
    Contributor

    Fixed via 05cb65e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: eclipsestatus: needs-discussiontype: enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions