Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve startup warning log when integrating with SpringBoot #1156

Open
ilxqx opened this issue May 28, 2024 · 0 comments
Open

Resolve startup warning log when integrating with SpringBoot #1156

ilxqx opened this issue May 28, 2024 · 0 comments
Labels
status/need-triage Team needs to triage and take a first look

Comments

@ilxqx
Copy link

ilxqx commented May 28, 2024

Have the following warning log when starting:

2024-05-28T11:26:03.392+08:00  WARN 74763 --- [state-machine] [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.statemachine.config.configuration.StateMachineAnnotationPostProcessorConfiguration' of type [org.springframework.statemachine.config.configuration.StateMachineAnnotationPostProcessorConfiguration$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [org.springframework.statemachine.processor.stateMachineAnnotationPostProcessor] is declared through a non-static factory method on that class; consider declaring it as static instead.

A possible solution:

Original code:

@Configuration
public class StateMachineAnnotationPostProcessorConfiguration {

	private final static String POST_PROCESSOR_BEAN_ID = "org.springframework.statemachine.processor.stateMachineAnnotationPostProcessor";

	@Bean(name = POST_PROCESSOR_BEAN_ID)
	public StateMachineAnnotationPostProcessor springStateMachineAnnotationPostProcessor() {
		return new StateMachineAnnotationPostProcessor();
	}

}

New code:

public class StateMachineAnnotationPostProcessorConfiguration {

	private final static String POST_PROCESSOR_BEAN_ID = "org.springframework.statemachine.processor.stateMachineAnnotationPostProcessor";

	@Bean(name = POST_PROCESSOR_BEAN_ID)
	public static StateMachineAnnotationPostProcessor springStateMachineAnnotationPostProcessor() {
		return new StateMachineAnnotationPostProcessor();
	}

}

SpringBoot considers StateMachineAnnotationPostProcessor as a PostProcessor. The creation of this bean necessitates the prior instantiation of the StateMachineAnnotationPostProcessorConfiguration class. However, the instantiation of this class further requires all PostProcessors to process it, including StateMachineAnnotationPostProcessor. Consequently, this results in a warning log indicating that some PostProcessors cannot process it. While it's true that the StateMachineAnnotationPostProcessorConfiguration class does not actually require any PostProcessor processing, SpringBoot is not intelligent enough to discern this. Though this warning is rather harmless, it can be somewhat bothersome to individuals with OCD😄.

@github-actions github-actions bot added the status/need-triage Team needs to triage and take a first look label May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/need-triage Team needs to triage and take a first look
Projects
None yet
Development

No branches or pull requests

1 participant