Skip to content

Resttemplate throws NPE with spring-boot-starter-log4j2 within tests #26120

@mnhock

Description

@mnhock

Resttemplate throws a NPE with dependency spring-boot-starter-log4j2 within tests calling RestTemplate construtor.

Repository for reproduce:

https://github.com/mnhock/resttemplate-bug

Simple call the RestConfigurationTest.

If you remove spring-boot-starter-log4j2 dependency from the pom it works.

The problem is that the init of the Logger depends on the SpringProperties as well but is initialized before the localProperties is initialized.

	private static final Log logger = LogFactory.getLog(SpringProperties.class);
	private static final Properties localProperties = new Properties();

I think the problem exists with other files changed in #25151 as well.

Thanks,
Martin

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions