[ 
https://issues.apache.org/jira/browse/CXF-1187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547841
 ] 

willem Jiang commented on CXF-1187:
-----------------------------------

This issue can be resolved by remove the annotation of @Resource(name = 
"activationNamespaces") , since there is no activationNamespaces bean in spring 
application context.  And The setActivationNamespaces method will be call when 
extension manager load the extension.

> Using Spring  <context:annotation-config /> spawns creation error on  
> org.apache.cxf.transport.servlet.ServletTransportFactory
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-1187
>                 URL: https://issues.apache.org/jira/browse/CXF-1187
>             Project: CXF
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.0.3
>         Environment: JDK 1.6
>            Reporter: Julien DUMETIER
>            Assignee: willem Jiang
>
> Consider the simple following Spring context defintion XML file:
> <?xml version="1.0" encoding="UTF-8"?>
> <beans 
> xmlns="http://www.springframework.org/schema/beans"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:util="http://www.springframework.org/schema/util"; 
> xmlns:context="http://www.springframework.org/schema/context"; 
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans 
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> http://www.springframework.org/schema/util 
> http://www.springframework.org/schema/util/spring-util-2.5.xsd
> http://www.springframework.org/schema/context 
> http://www.springframework.org/schema/context/spring-context-2.5.xsd
> ">
>       <import resource="classpath:META-INF/cxf/cxf.xml" />
>       <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> </beans>
> And the simple following laucher:
> package test;
> import org.springframework.context.support.ClassPathXmlApplicationContext;
> public class MainTest {
>       public static void main(String[] args) {
>             new ClassPathXmlApplicationContext("classpath:test/context.xml");
>       }
>       
> }
> All works fine.
> But if you use new Spring annotation configuration capabilities, adding the 
> following to the definition file:
> <context:annotation-config />
> Then, you will get the following exception:
> Exception in thread "main" 
> org.springframework.beans.factory.BeanCreationException: Error creating bean 
> with name 'org.apache.cxf.transport.servlet.ServletTransportFactory#0': 
> Injection of resource methods failed; nested exception is 
> org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean 
> named 'activationNamespaces' is defined
> Because org.apache.cxf.transport.http.AbstractHTTPTransportFactory shows the 
> following annotation on the setter, although "No bean named 
> 'activationNamespaces' is defined":
>     @Resource(name = "activationNamespaces")
>     public void setActivationNamespaces(Collection<String> ans) {
>         activationNamespaces = ans;
>     }
> Annotation config is now widely spread among Spring projects, and will become 
> pervasive the new Spring 2.5 testing framework, based on a the annotation 
> configuration capabilities. 
> A workaround is to add a collection of string named "activationNamespaces" to 
> the context, adding the following: 
> <util:list id="activationNamespaces" value-type="java.lang.String" />
> But cxf.xml should be refactored to avoid this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to