Skip to content

@Configuration classes can no longer be abstract without @Bean methods #34663

Closed
@pnavato

Description

@pnavato

I have just upgraded to spring-boot 3.4.4 (I have only changed the version number of spring-boot-starter-parent), and several tests fail with an error message like the following.

Error creating bean with name 'MyAbstractTest': Failed to instantiate [com.mycompany.myapp.MyAbstractTest]: Is it an abstract class?

These tests extend an abstract class named, let's say MyAbstractTest, that is annotated with:

@ExtendWith(SpringExtension.class)
@Configuration
@ContextConfiguration(classes = MyAbstractTest.class)

The tests work again if I move @ContextConfiguration to each concrete subclass and reference the concrete subclass:

@ContextConfiguration(classes = MyConcreteTest.class)

This change is not needed with spring-boot 3.4.3, so I assume it's a regression, isn't it?

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: 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