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

Vladimir Kulev commented on CXF-3725:
-------------------------------------

This works for me:
{code:java}
@Configuration
@ComponentScan
@ImportResource({"classpath:META-INF/cxf/cxf.xml"})
public class Context {
    @Autowired
    private ApplicationContext ctx;

    @Bean
    public Server jaxRsServer() {
        LinkedList<ResourceProvider> resourceProviders = new LinkedList<>();
        for (String beanName : ctx.getBeanDefinitionNames()) {
            if (ctx.findAnnotationOnBean(beanName, Path.class) != null) {
                SpringResourceFactory factory = new 
SpringResourceFactory(beanName);
                factory.setApplicationContext(ctx);
                resourceProviders.add(factory);
            }
        }

        JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
        factory.setBus(ctx.getBean(SpringBus.class));
        factory.setProviders(Arrays.asList(new JacksonJsonProvider()));
        factory.setResourceProviders(resourceProviders);
        return factory.create();
    }
}
{code}

> JAXRS must be able to expose all spring components marked with @Path
> --------------------------------------------------------------------
>
>                 Key: CXF-3725
>                 URL: https://issues.apache.org/jira/browse/CXF-3725
>             Project: CXF
>          Issue Type: New Feature
>          Components: JAX-RS
>            Reporter: Olivier Lamy (*$^¨%`£)
>
> To ease dev and not to have to declare all beans.
> See sample :
> {code}
> not   
> <jaxrs:server id="bookservice" address="/">
>   <jaxrs:serviceBeans>
>     <ref bean="bookstore"/>
>     <ref bean="bookstoreInterface"/>
>   </jaxrs:serviceBeans>
> </jaxrs:server>
> but 
> <jaxrs:server id="bookservice" address="/">
>   <jaxrs:serviceBeans all-beans="true">
>     
>   </jaxrs:serviceBeans>
> </jaxrs:server>
> All spring components marked with @Path as it will be exposed
> @Path( "/userService/" )
> @Service("userService#rest")
> public class DefaultUserService
>     implements UserService
> {code}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to