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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0
    • 3.0.2, 3.1
    • JAX-RS
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: