spring-projects/spring-boot — pull request #529 by dsyer (2014-03-19 19:50:12+00:00)
Title: Spring Boot does not notice spring.factories declarations in JARs added via -cp

Currently, if a `spring.factories` file is defined in either an application or a JAR included within a Spring Boot packaged application (e.g. via the Maven plugin), it's contents are read and executed as expected. However, if a JAR is added to the classpath via the `cp` argument (e.g. `java -cp additional.jar -jar application.jar`), its `spring.factories` file is not detected and executed as expected.

A simple application demonstrating this behavior can be found at . Given the a clone of the repository, this behavior can be demonstrated by running `mvn clean package && ./reproduce.sh`.

The output of this command currently looks like:

```bash
Executing: java -cp external-dependency/target/external-dependency-1-SNAPSHOT.jar -jar application/target/application-1-SNAPSHOT.jar

. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.0.0.RC4)

2014-03-19 10:31:44.714 WARN 6486 --- [ main] c.n.LocalApplicationContextInitializer : Executing LocalApplicationContextInitializer
2014-03-19 10:31:44.719 INFO 6486 --- [ main] com.nebhale.Application : Starting Application on bhale-desktop.local with PID 6486 (/Users/bhale/dev/sources/nebhale/spring-factories-loader-bug/application/target/application-1-SNAPSHOT.jar started by bhale)
```

Ideally, the output would look like:

```bash
Executing: java -cp external-dependency/target/external-dependency-1-SNAPSHOT.jar -jar application/target/application-1-SNAPSHOT.jar

. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.0.0.RC4)

2014-03-19 10:30:16.548 WARN 6436 --- [ main] c.n.LocalApplicationContextInitializer : Executing LocalApplicationContextInitializer
2014-03-19 10:30:16.552 WARN 6436 --- [ main] c.n.RemoteApplicationContextInitializer : Executing RemoteApplicationContextInitializer
2014-03-19 10:30:16.553 INFO 6436 --- [ main] com.nebhale.Application : Starting Application on bhale-desktop.local with PID 6436 (/Users/bhale/dev/sources/nebhale/spring-factories-loader-bug/application/target/application-1-SNAPSHOT.jar started by bhale)
```

The initial discussions of this problem can be found in #322.