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

Torben Vesterager commented on CXF-4719:
----------------------------------------

As a CXF with Spring user, I can tell you the minimal configuration needed 
today - spring 3.1+, servlet 3.0+ (no web.xml):
{code:java|title=WebApplicationInitializer implementation}
@ImportResource({"classpath:cxf.xml"})

...

        @Override
        public void onStartup(ServletContext container) {
                ...
                // Register and map the CXF servlet
                ServletRegistration.Dynamic cxf = container.addServlet("cxf", 
new CXFServlet());
                cxf.setLoadOnStartup(2);
                cxf.addMapping("/service/*");
        }
{code} 

{code:xml|title=cxf.xml}
<beans xmlns="http://www.springframework.org/schema/beans";
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
           xmlns:jaxws="http://cxf.apache.org/jaxws";
           xsi:schemaLocation="
         http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
         http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd";>

        <import resource="classpath:META-INF/cxf/cxf.xml"/>
        <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>

        <jaxws:endpoint id="[Name]Service"
                        implementor="com.mycompany.mywebapp.[Name]Service"
                        address="/internal/[Name]Service-v1"/>
</beans>
{code} 

{code:java|title=[Name]Service.java}
@WebService(serviceName = "[Name]Service", portName = 
"/internal/[Name]Service-v1", targetNamespace = 
"http://mycompany.com/internal/[Name]Service/v1";)
public class [Name]Service {
        ...

        @WebMethod
        public String someWebServiceMethod(@WebParam(name = "userContext") 
UserContext userContext, ...) {
        }
{code} 

And then the cxf-java2ws-plugin in the maven pom.
                
> Annotation for web service endpoint
> -----------------------------------
>
>                 Key: CXF-4719
>                 URL: https://issues.apache.org/jira/browse/CXF-4719
>             Project: CXF
>          Issue Type: Improvement
>            Reporter: Torben Vesterager
>
> CXF is the only thing I'm using that still needs a spring configuration XML.
> All other components are configurable via annotations.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to