Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Configuration

...

Subpages

Children Display

Supplying a Configuration file to CXF

...

Enabling message logging using plain Spring bean elements

Note

Using this format is STRONGLY discouraged as it ties your configuration with internal CXF class names (like SpringBus). It is much better to use the cxf:bus element described below

Code Block
xml
xml
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
    <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
	
    <bean id="cxf" class="org.apache.cxf.bus.spring.SpringBus">
        <property name="inInterceptors">
            <list>
                <ref bean="logInbound"/>
            </list>
        </property>
        <property name="outInterceptors">
            <list>
                <ref bean="logOutbound"/>
            </list>
        </property>
        <property name="outFaultInterceptors">
            <list>
                <ref bean="logOutbound"/>
            </list>
        </property>
        <property name="inFaultInterceptors">
            <list>
                <ref bean="logInbound"/>
            </list>
        </property>
    </bean> 
</beans>

In this example, you specify that the CXF bus is implemented by class org.apache.cxf.bus.spring.SpringBus, and that it's its id is "cxf". This is the default, but you have to re-iterate the fact if you want the bus to contribute the logging interceptors to the outbound and inbound interceptor chain for all client and server endpoints. You can avoid this duplication by using the next form of configuration:

...

Enabling message logging using custom CXF bean elements

...