Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6003

jaxrs:server "basePackages" attribute doesn't initialize REST services properly

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.0.2, 3.1
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      As I see, there is a feature to let cxf detect REST services automatically through "basePackages" attribute of "jaxrs:server" tag.
      it supposed to scan classpath and create beans for classes with @Path(and @Provider) annotation. the problem is Spring Autowiring doesn't work for these beans, so there is no way to initialize REST services properly.
      I saw the code and think found the problem. in JAXRSServerFactoryBeanDefinitionParser if you change

      providers.add(context.getAutowireCapableBeanFactory().createBean(clazz));
      

      to:

      providers.add(context.getAutowireCapableBeanFactory().createBean(clazz, 2, true));
      

      everything works fine. it simply tells spring to enable autowiring in bean creation.

        Attachments

          Activity

            People

            • Assignee:
              sergey_beryozkin Sergey Beryozkin
              Reporter:
              hesamwls Hesam Talebi
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: