cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: How to use javax.ws.rs.core.Feature with SpringComponentScanServer
Date Tue, 26 Apr 2016 08:29:29 GMT
Thanks for reopening CXF-6879

Cheers, Sergey
On 25/04/16 05:58, Nicolas Mongrain-Lacombe wrote:
> I am trying to use a JAX-RS Feature (javax.ws.rs.core.Feature, not the CXF
> org.apache.cxf.feature.Feature) with SpringComponentScanServer
> (org.apache.cxf.jaxrs.spring.SpringComponentScanServer).
>
> Is there any support for that?
>
> Here is how I tried to configure CXF:
>
> import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;import
> com.mycustomapp.restexception.providers.RestExceptionFeature;import
> org.apache.cxf.jaxrs.spring.SpringComponentScanServer;import
> org.springframework.context.annotation.Bean;import
> org.springframework.context.annotation.Configuration;import
> org.springframework.context.annotation.Import;
> @Configuration@Import(SpringComponentScanServer.class)public class
> CxfConfiguration{
>      @Bean
>      public RestExceptionFeature restExceptionFeature()
>      {
>          return new RestExceptionFeature();
>      }
>
>      @Bean
>      public JacksonJsonProvider jacksonJsonProvider()
>      {
>          return new JacksonJsonProvider();
>      }}
>
> Here is my custom feature:
>
> import javax.ws.rs.core.Feature;import
> javax.ws.rs.core.FeatureContext;import javax.ws.rs.ext.Provider;
> @Providerpublic class RestExceptionFeature implements Feature{
>      @Override
>      public boolean configure(FeatureContext context)
>      {
>          context.register(RestExceptionBodyReader.class);
>          context.register(RestExceptionMapper.class);
>          context.register(RestExceptionCxfClientMapper.class);
>
>          return true;
>      }}
>
> RestExceptionFeature.configure() is never called.
>
> I created a stackoverflow question if anyone wants to answer there:
> http://stackoverflow.com/questions/36832092/how-to-use-javax-ws-rs-core-feature-with-cxf
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Mime
View raw message