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

When classes in spring-core and spring-boot are loaded by different ClassLoaders, spring-boot cannot find its own config data location resolvers #26149

Closed
wants to merge 3 commits into from

Conversation

vsriram92
Copy link
Contributor

@vsriram92 vsriram92 commented Apr 17, 2021

To pass appropriate classloader as an argument to load factory names.

Consider a scenario where Spring-core is loaded from ${catalina.home}/lib and Spring-boot is loaded from project-specific WEB-INF/lib.
Without passing the classloader, SpringFactoriesLoader present in the Spring-Core is unable to find the loaded config classes such as ConfigTreeConfigDataLocationResolver and StandardConfigDataLocationResolver.

Due to which migration from 2.2.x from 2.4.x is causing UnsupportedConfigDataLocationException.
Unsupported config data location 'optional:file:./config/*/'
For more reference of the issue - https://stackoverflow.com/questions/67134959/spring-boot-unsupported-config-data-location-optionalfile-config

To pass appropriate classloader as an argument to load factory names similar to spring boot versions < 2.4.0
@pivotal-issuemaster
Copy link

@vsriram92 Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-issuemaster
Copy link

@vsriram92 Thank you for signing the Contributor License Agreement!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 17, 2021
@vsriram92
Copy link
Contributor Author

Getting Checkstyle and formatting issue in the build. As a newbie, not sure what it expects / what rules it follows.

@wilkinsona
Copy link
Member

wilkinsona commented Apr 17, 2021

Thanks for the PR, @vsriram92.

If you run the build locally, as you should before submitting a PR, the output should explain what the problems are. In the case of the formatting problems, it also indicates that you can run format, i.e. ./gradlew format, to fix them.

The Checkstyle errors are the following:

> Task :spring-boot-project:spring-boot:checkstyleMain
[ant:checkstyle] [ERROR] /tmp/build/6da1d659/git-repo/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataLocationResolvers.java:57: Line matches the illegal pattern 'Trailing whitespace'. [Regexp]
[ant:checkstyle] [ERROR] /tmp/build/6da1d659/git-repo/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigDataLocationResolvers.java:58: Line has leading space characters; indentation should be performed with tabs only. [RegexpSinglelineJava]

I think format may fix these too. If it doesn't, using tabs for indentation and removing any trailing whitespace should fix the problem.

@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 19, 2021
@wilkinsona wilkinsona added this to the 2.4.x milestone Apr 19, 2021
@wilkinsona wilkinsona self-assigned this Apr 19, 2021
@wilkinsona wilkinsona modified the milestones: 2.4.x, 2.4.6 Apr 19, 2021
@wilkinsona wilkinsona changed the title Pass the appropriate classloader to load factory names When classes in spring-core and spring-boot are loaded by different ClassLoaders, spring-boot cannot find its own config data location resolvers Apr 19, 2021
@wilkinsona
Copy link
Member

@vsriram92 Thank you very much for making your first contribution to Spring Boot.

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

Successfully merging this pull request may close these issues.

None yet

4 participants