[ https://issues.apache.org/jira/browse/CXF-8666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17709269#comment-17709269 ]
knoobie edited comment on CXF-8666 at 4/6/23 7:56 AM: ------------------------------------------------------ This is not just an issue in tests, it also affects all Spring6 / Boot3 applications that inject the `jakarta.xml.ws.WebServiceContext` into their endpoints, resulting in the above exception and a not-starting application. Raising this concern at Spring Framework was [rejected|https://github.com/spring-projects/spring-framework/issues/27422#issuecomment-1497510459]. Workaround: {code:java} @Configuration public class WorkaroundForCxfConfig { @Autowired private CommonAnnotationBeanPostProcessor processor; @PostConstruct public void initialize() { processor.ignoreResourceType("jakarta.xml.ws.WebServiceContext"); } } {code} was (Author: JIRAUSER299715): This is not just an issue in tests, it also affects all Spring6 / Boot3 applications that inject the `jakarta.xml.ws.WebServiceContext` into their endpoints, resulting in the above exception and a not-starting application. Raising this concern at Spring Framework was [rejected|https://github.com/spring-projects/spring-framework/issues/27422#issuecomment-1497510459]. Workaround: ```java @Configuration public class WorkaroundForCxfConfig { @Autowired private CommonAnnotationBeanPostProcessor processor; @PostConstruct public void initialize() { processor.ignoreResourceType("jakarta.xml.ws.WebServiceContext"); } } ``` > Spring6 for JSR 250 annotations isn't disabled for > jakarta.xml.ws.WebServiceContext > ----------------------------------------------------------------------------------- > > Key: CXF-8666 > URL: https://issues.apache.org/jira/browse/CXF-8666 > Project: CXF > Issue Type: Bug > Components: JAX-WS Runtime > Affects Versions: 3.5.0, 3.4.5 > Reporter: Jim Ma > Priority: Major > > The test is failed after Spring6 upgrade. > {code:java} > [INFO] Running org.apache.cxf.jaxws.spring.SpringBeansTest > [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.716 > s <<< FAILURE! - in org.apache.cxf.jaxws.spring.SpringBeansTest > [ERROR] org.apache.cxf.jaxws.spring.SpringBeansTest.testCXF3959SpringInject > Time elapsed: 0.661 s <<< ERROR! > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'org.apache.cxf.jaxws.EndpointImpl--1761046809': Cannot create > inner bean '(inner bean)#338c99c8' of type > [org.apache.cxf.jaxws.spring.PostConstructCalledCount] while setting > constructor argument; nested exception is > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name '(inner bean)#338c99c8': Injection of resource dependencies failed; > nested exception is > org.springframework.beans.factory.NoSuchBeanDefinitionException: No > qualifying bean of type 'jakarta.xml.ws.WebServiceContext' available: > expected at least 1 bean which qualifies as autowire candidate. Dependency > annotations: {@jakarta.annotation.Resource(shareable=true, lookup="", > name="", description="", authenticationType=CONTAINER, > type=java.lang.Object.class, mappedName="")} > at > org.apache.cxf.jaxws.spring.SpringBeansTest.testCXF3959SpringInject(SpringBeansTest.java:482) > Caused by: org.springframework.beans.factory.BeanCreationException: Error > creating bean with name '(inner bean)#338c99c8': Injection of resource > dependencies failed; nested exception is > org.springframework.beans.factory.NoSuchBeanDefinitionException: No > qualifying bean of type 'jakarta.xml.ws.WebServiceContext' available: > expected at least 1 bean which qualifies as autowire candidate. Dependency > annotations: {@jakarta.annotation.Resource(shareable=true, lookup="", > name="", description="", authenticationType=CONTAINER, > type=java.lang.Object.class, mappedName="")} > at > org.apache.cxf.jaxws.spring.SpringBeansTest.testCXF3959SpringInject(SpringBeansTest.java:482) > Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: > No qualifying bean of type 'jakarta.xml.ws.WebServiceContext' available: > expected at least 1 bean which qualifies as autowire candidate. Dependency > annotations: {@jakarta.annotation.Resource(shareable=true, lookup="", > name="", description="", authenticationType=CONTAINER, > type=java.lang.Object.class, mappedName="")} > at > org.apache.cxf.jaxws.spring.SpringBeansTest.testCXF3959SpringInject(SpringBeansTest.java:482){code} > > Spring5 has this setting in > {code:java} > org.springframework.context.annotation.CommonAnnotationBeanPostProcessor{code} > {code:java} > this.ignoreResourceType("javax.xml.ws.WebServiceContext");{code} > but this setting for jakarta.xml.ws.WebServiceContext is removed in Spring6, > see > [https://github.com/spring-projects/spring-framework/issues/27422] > > The source code in Spirng5 and Spring6: > https://github.com/spring-projects/spring-framework/blob/v5.3.16/spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java#L207 > https://github.com/spring-projects/spring-framework/blob/v6.0.0-M2/spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java#L179 -- This message was sent by Atlassian Jira (v8.20.10#820010)