Features in CXF
A Feature in CXF is a way of adding capabilities to a Server, Client or Bus. For example, you could add the ability to log messages for each of these objects, by configuring them with a LoggingFeature. To implement a Feature, you must subclass AbstractFeature below. By default the initialize methods all delegate to initializeProvider(InterceptorProvider), so if you're simply adding interceptors to a Server, Client, or Bus, this allows you to add them easily.
Writing and configuring the Feature
CXF provides several features to configure commonly used capabilities, such as logging, failover, policies, addressing, and reliable messaging. You can go to the FeaturesList for more information.
Writing a Feature
It is very easy to write a new feature; your feature just needs to extends the AbstractFeature and implement initializeProvider or write customizing code for configuring client or server interceptors. Here is an example for implementing the logging feature.
Adding a Feature programmatically
To add the feature to both server and client, you can use the Feature annotation on the service class
You can also add the feature to the server by using ServerFactoryBean, or the client by using the ClientFactoryBean or the ClientProxyFactoryBean
It is also possible to add a feature when publishing an Endpoint via Endpoint.publish. For example, the Logging feature can be added as follows:
Adding a Feature through configuration
Here are some examples on using configuration files to add features. You can find more information about the CXF provides features at FeaturesList.