By creating a bus with your own bean configuration file, i.e. using the factory method
SpringBusFactory.createBus("mycxf.xml")
you can complement or overwrite the bean definitions that CXF would use by default. In this case mycxf.xml
must be on the classpath, but you can also use a factory method taking a URL that points to your bean configuration file.
For example, by replacing the bus bean defined in cxf.xml
with this bean in your configuration file:
<bean id="cxf" class="org.apache.cxf.bus.spring.SpringBus"> <property name="outInterceptors"> <list> <ref bean="myLoggingInterceptor"/> </list> </property> </bean> <bean id="myLogHandler" class="org.mycompany.com.cxf.logging.LoggingInterceptor"> ... </bean>
the constructed bus will use a list of out interceptors consisting of your LoggingInterceptor (the default list of out interceptors at the bus level is empty).
1 Comment
Nick Birnie
Looks like SpringBeanFactory should be replaced with SpringBusFactory.