Currently I have a project (excerpt from a larger project) with the following class:
@Component
@ConfigurationProperties("xyz")
public class ConfigurationLeiDaD {
private static final Logger LOG = LoggerFactory.getLogger(ConfigurationLeiDaD.class);
private static final String DEFAULT_INBOUND = "inbound";
private Path baseDirectory;
private Path inbound;
ConfigurationLeiDaD() {
this.baseDirectory = null;
this.inbound = null;
}
public Path getBaseDirectory() {
return baseDirectory;
}
void setBaseDirectory(Path baseDirectory) {
this.baseDirectory = baseDirectory;
}
public Path getInbound() {
return Objects.requireNonNullElseGet(this.inbound, () -> this.baseDirectory.resolve(DEFAULT_INBOUND));
}
}
Furthermore I have simple service which uses the above configuration which just prints out the information on the console:
@Service
public class FirstService {
private static final Logger LOG = LoggerFactory.getLogger(FirstService.class);
private final ConfigurationLeiDaD configurationLeiDaD;
public FirstService(ConfigurationLeiDaD configurationLeiDaD) {
this.configurationLeiDaD = configurationLeiDaD;
}
@EventListener(classes = ApplicationReadyEvent.class)
void applicationReady(@NonNull ApplicationReadyEvent event) {
LOG.info("Event {}", event);
Path inbound = configurationLeiDaD.getInbound();
LOG.info("inbound: {}", inbound);
}
}
I'm starting the spring boot (Spring Boot Version 2.4.3) app via:
java -jar target/spring-boot-issue-1.0.0-SNAPSHOT-exec.jar --xyz.base-directory=/Absolute/Directory/Path/
The output of the application on console looks like this (excerpt):
2021-03-24 16:17:05.119 INFO 45592 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-03-24 16:17:05.316 INFO 45592 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-03-24 16:17:05.325 INFO 45592 --- [ main] io.soebes.simple.MainApplication : Started MainApplication in 1.772 seconds (JVM running for 2.197)
2021-03-24 16:17:05.327 INFO 45592 --- [ main] io.soebes.simple.service.FirstService : Event org.springframework.boot.context.event.ApplicationReadyEvent[source=org.springframework.boot.SpringApplication@3f23a3a0]
2021-03-24 16:17:05.328 INFO 45592 --- [ main] io.soebes.simple.service.FirstService : inbound: /Absolute/Directory/Path/inbound
As you can see in the output of the value is just give as expected.
Now I simply change the Spring Boot version from 2.4.3 to 2.4.4 and rebuild the project and call it the same way:
But now the output looks like:
2021-03-24 16:15:43.073 INFO 45553 --- [ main] i.s.simple.config.ConfigurationLeiDaD : baseDirectory /private/var/folders/gb/sw0f5qsx4m95znm_fjw3nfwh0000gn/T/tomcat-docbase.8080.10431842645162390813/Absolute/Directory/Path
2021-03-24 16:15:43.201 INFO 45553 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-03-24 16:15:43.404 INFO 45553 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-03-24 16:15:43.415 INFO 45553 --- [ main] io.soebes.simple.MainApplication : Started MainApplication in 2.04 seconds (JVM running for 2.477)
2021-03-24 16:15:43.417 INFO 45553 --- [ main] io.soebes.simple.service.FirstService : Event org.springframework.boot.context.event.ApplicationReadyEvent[source=org.springframework.boot.SpringApplication@5fb97279]
2021-03-24 16:15:43.417 INFO 45553 --- [ main] io.soebes.simple.service.FirstService : inbound: /private/var/folders/gb/sw0f5qsx4m95znm_fjw3nfwh0000gn/T/tomcat-docbase.8080.10431842645162390813/Absolute/Directory/Path/inbound
As you can see the output of the absolute directory is prefixed by something which is not given via command line...
I have created a small project to reproduce this.
https://github.com/khmarbaise/spring-boot-issue
Just change the version for Spring Boot Version from 2.4.3 to 2.4.4 and call the command line as described in the above examples.
The question is now: Do I have missed something to read in the release notes of 2.4.4 ? Or is there something else I'm missing?
- JDK 11.0.9
- Maven 3.6.3 (for building)
- Spring Boot 2.4.3/2.4.4
Comment From: wilkinsona
Thanks for the report. This is a duplicate of https://github.com/spring-projects/spring-framework/issues/26702.