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

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

Open
josephearl opened this issue Nov 24, 2023 · 11 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@josephearl
Copy link

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.

@nikolay-hr
Copy link

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 ;)

@Nestoter
Copy link

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?

@nikolay-hr
Copy link

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

@corneil corneil closed this as completed May 9, 2024
@swiss-chris
Copy link

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

@fischermatte
Copy link

fischermatte commented Jun 20, 2024

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

@wilkinsona
Copy link
Member

wilkinsona commented Jun 20, 2024

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:

/**
* Returns a {@link AnnotationActionEndpointMapping} ordered at 2 for mapping requests to annotated endpoints.
*/
@Bean
public AnnotationActionEndpointMapping annotationActionEndpointMapping() {
AnnotationActionEndpointMapping endpointMapping = new AnnotationActionEndpointMapping();
endpointMapping.setOrder(2);
endpointMapping.setPostInterceptors(getInterceptors());
return endpointMapping;
}

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.

@72wildcard
Copy link

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

@hpoettker
Copy link

I don't think the issue should be closed, but the problem is more complicated than it sounds in #1391 (comment) 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.

@leventunver
Copy link

leventunver commented Jul 16, 2024

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.

@nikolay-hr
Copy link

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.

@tbuchloh
Copy link

Why was this ticket closed? The warning is still present in Spring Boot 3.3.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests