cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Kulev (JIRA)" <>
Subject [jira] [Commented] (CXF-6694) SpringResourceFactory does not work with constructor-autowired beans
Date Fri, 04 Dec 2015 17:15:10 GMT


Vladimir Kulev commented on CXF-6694:

Frontend is JAXRS service, it gets discovered automatically by {{SpringComponentScanServer}},
you can access it at http://localhost:8080/api/status
Backend is just a normal bean used to demonstrate idea of not having default constructor for
JAXRS service class in case of Spring.

Another way to do it in Spring (in this case you don't need to write those @Bean methods):
    public static class Frontend {

        private final Backend backend;

        public Frontend(Backend backend) {
            this.backend = backend;

        public String getStatus() {
            return backend.getStatus();

    public static class Backend {

        public String getStatus() {
            return "Hello, world!";

> SpringResourceFactory does not work with constructor-autowired beans
> --------------------------------------------------------------------
>                 Key: CXF-6694
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.4
>            Reporter: Vladimir Kulev
>              Labels: spring
>         Attachments: CXF-6694.patch
> When used with constructor-autowired bean, it fails with "Resource class ... has no valid
constructor" exception. We don't need constructor at all when we already have a singleton
instance from Spring.
> Also it looks like {{isSingleton()}} is called for the first time before correct value
is calculated a few lines below: {{isSingleton = ac.isSingleton(beanId)}}

This message was sent by Atlassian JIRA

View raw message