spring-ws icon indicating copy to clipboard operation
spring-ws copied to clipboard

Spring Boot 3.2.0 new warning about `DelegatingWsConfiguration is not eligible for getting processed by all BeanPostProcessors`

Open josephearl opened this issue 1 year ago • 3 comments

After upgrading to Spring Boot 3.2.0 our services that use spring-boot-starter-web-services now log a new warning on startup:

logger_name: org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker level: WARN

Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [annotationActionEndpointMapping] is declared through a non-static factory method on that class; consider declaring it as static instead.

josephearl avatar Nov 24 '23 18:11 josephearl

This message was info level in 3.1.x but now after 3.2.x is a warning - you can check the changes from here.

Auto-proxying is a mechanism in Spring AOP where Spring automatically creates proxy objects around your beans to add additional behavior, such as method interception for applying cross-cutting concerns like security, logging, etc.

The message indicates that the bean DelegatingWsConfiguration is not eligible for processing by all BeanPostProcessors. Specifically, it mentions that it's "not eligible for auto-proxying." After adding a @Bean for DelegatingWsConfiguration

@Bean
public DelegatingWsConfiguration delegatingWsConfiguration() {
     return new DelegatingWsConfiguration();
}

the warning disappears. Please don't take this as a solution @josephearl because it depends on what spring-boot-starter-web-services is used for ;)

nikolay-hr avatar Jan 31 '24 20:01 nikolay-hr

This message was info level in 3.1.x but now after 3.2.x is a warning - you can check the changes from here.

Auto-proxying is a mechanism in Spring AOP where Spring automatically creates proxy objects around your beans to add additional behavior, such as method interception for applying cross-cutting concerns like security, logging, etc.

The message indicates that the bean DelegatingWsConfiguration is not eligible for processing by all BeanPostProcessors. Specifically, it mentions that it's "not eligible for auto-proxying." After adding a @Bean for DelegatingWsConfiguration

@Bean
public DelegatingWsConfiguration delegatingWsConfiguration() {
     return new DelegatingWsConfiguration();
}

the warning disappears. Please don't take this as a solution @josephearl because it depends on what spring-boot-starter-web-services is used for ;)

Hi @nikolay-hr , I have this same issue but i'm not able to find the class DelegatingWsConfiguration in my project. I think this is a springboot class and i cannot add the @Bean annotation. Where did you put that code snippet you provided?

Nestoter avatar Feb 10 '24 17:02 Nestoter

Hi @Nestoter Yes it is from spring-boot project, using spring-boot-starter-web-services dependencies.

The parent of spring-boot-starter-web-services with spring-boot 3.2.2 is

<parent>
    <groupId>org.springframework.ws</groupId>
    <artifactId>spring-ws</artifactId>
    <version>4.0.8</version>
</parent>

You can find the source here - spring-ws-core

nikolay-hr avatar Feb 12 '24 19:02 nikolay-hr

Hello What's the recommended action for getting rid of this warning?

swiss-chris avatar Jun 19 '24 15:06 swiss-chris

Hello What's the recommended action for getting rid of this warning?

Same question here, this warning still comes with Java 21, spring boot 3.2.5 and spring-ws 4.0.10

fischermatte avatar Jun 20 '24 08:06 fischermatte

I don't think this issue should have been closed. The warning message identifies that the cause of the problem is the annotationActionEndpointMapping bean:

2024-06-20T11:51:28.671+01:00  WARN   --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [annotationActionEndpointMapping] is declared through a non-static factory method on that class; consider declaring it as static instead.

This bean is declared in Spring WS's WsConfigurationSupport:

https://github.com/spring-projects/spring-ws/blob/5e73b4c5549cec75a70b2f36c0647e1e82777df8/spring-ws-core/src/main/java/org/springframework/ws/config/annotation/WsConfigurationSupport.java#L104-L113

As the warning describes, it's a BeanPostProcessor but the @Bean method is not static. This causes DelegatingWsConfiguration (a sub-class of WsConfigurationSupport ) to be created very early so that the annotationActionEndpointMapping bean can be created and can perform its post-processing. This prevents DelegatingWsConfiguration itself from being post-processed.

WsConfiguration needs to be updated to declare annotationActionEndpointMapping as static.

wilkinsona avatar Jun 20 '24 10:06 wilkinsona

@bclozel @corneil May I ask why this issue was closed?

72wildcard avatar Jul 08 '24 09:07 72wildcard

I don't think the issue should be closed, but the problem is more complicated than it sounds in https://github.com/spring-projects/spring-ws/issues/1391#issuecomment-2180394331 above.

The method annotationActionEndpointMapping cannot be declared static as it calls the method getInterceptors, which isn't static. And these interceptors really come from injected WsConfigurers, so it is indeed a logical problem that AnnotationActionEndpointMapping is a BeanPostProcessor but depends itself on other beans.

Any solution will most likely require a breaking change.

hpoettker avatar Jul 10 '24 12:07 hpoettker

Hi @nikolay-hr, could you elaborate on why your solution shouldn't be used? Is it because of a concern that you have or is it because it may not work? You mentioned that it depends on what spring-boot-starter-web-services is used for but I didn't really understand what you mean by that.

leventunver avatar Jul 16 '24 13:07 leventunver

Hi @leventunver. Defining a DelegatingWsConfiguration as a bean can help eliminate BeanPostProcessor warning, but it could not work in the future. Also applyBeanPostProcessorsAfterInitialization is deprecated since 6.1 and as you can see this is the entry point of where postProcessAfterInitialization is called.

nikolay-hr avatar Jul 22 '24 20:07 nikolay-hr