Skip to content

Fail fast if a @Bean method has a void return type #31007

Closed
@snicoll

Description

@snicoll

It is currently possible to craft the following faulty configuration:

@Configuration
public class FaultyConfiguration {

	@Bean
	public void faultyBean() {
		System.out.println("Hello");
	}

}

As a result of processing this configuration class, "Hello" is displayed during the processing phase and a NullBean bean is contributed. We should reject this upfront.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions