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

Comment From: pivotal-issuemaster

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

Comment From: pivotal-issuemaster

@vsriram92 Thank you for signing the Contributor License Agreement!

Comment From: vsriram92

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

Comment From: wilkinsona

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.

Comment From: wilkinsona

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