Skip to content

Spring Test should not modify the application context under test [SPR-8503] #13149

Closed
@spring-projects-issues

Description

@spring-projects-issues

Neale Upstone opened SPR-8503 and commented

When using @ContextConfiguration in a test @Autowired annotated fields get wired, even if context:annotation-driven/ has not been specified.

This is incorrect behaviour, as it means that a test can pass against a context configuration which when used in production will not behave that way.

A better approach would be to load the specified configuration into one application context, and then use a child context for wiring the test fixture.

The child context can then have the additional post processors, without polluting the application context under test.


Affects: 3.1 M2

Issue Links:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions