Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-91315

Migrate majority of service modules to use Service Builder dependency-injector=ds property and regenerate without spring files


    • Type: Story
    • Status: Closed
    • Priority: Minor
    • Resolution: Completed
    • Affects Version/s: None
    • Fix Version/s: 7.2.X, Master
    • Component/s: Core Infrastructure
    • Labels:


      Apply new ServiceBuilder property to generate service modules without using spring.

      Apply service-builder attribute


      which specifies dependency injector with DS. Valid values for "dependency-injector" are "spring" and "ds". For new OSGi modules, the default value is "ds", for existing modules or WARs, the default value is "spring".

      Using "ds" will regenerate the module using DS Component annotations and wire everything together using DS. Doing so is incompatible with using any spring.xml files in the module but allows developers to choose how they want to build their services.

      Here are the steps to manually modify a service module to use dependency-injector="ds"

      1. Add the DS annotation option for inherited dependencies
      2. Update build to include com.liferay.portal.aop.api
      3. For each non-generated spring bean do the following:
        1. Set the Component annotation on the *Impl class
          1. If the Impl class is a finder, then use the Finder's interface as the service Component(service = MyFinder.class)
          2. If the Impl class is a remote or local service, then use the AopService interface Component(service = AopService.class)
          3. Set the the Component property attribute on remote and local services
            1. For remote services set the "json.web.service.context.name" and "json.web.service.context.path" properties to enable json web services the values can be found in OSGiBeanProperties in the remote service interface before regenerating
            2. For local services set the "model.class.name" property to enable PersistedModelLocalService service tracking, the value is the full class name of the service entity
        2. Replace all service ServiceReference and BeanReference annotations on fields with DS Reference annotations
      4. Regenerate the service after setting dependency-injector="ds" in the service.xml
      5. Replace all manual afterPropertiesSet() and destory() methods with activate() and deactivate() methods and annotate them with Activate and Deactivate DS annotations
      6. Some references will no longer be generated to avoid causing circular dependencies withing a service module, these can be easily added back by adding the necessary fields to the ServiceImpl with DS Reference annotations to resolve compile failures
      7. Deploy the service module and start the portal
      8. Run system:check in the gogo shell to confirm there are no circular service dependencies
      9. If there are components that are not resolving the most likely issue is circular dependencies between local services using scr:info <component.name> in the gogo shell can help in understanding where the easiest place is to break the dependency circle


          Issue Links

          There are no Sub-Tasks for this issue.



              victor.ware Victor Ware
              zheyi.ji Lance Ji (Inactive)
              Recent user:
              Kiyoshi Lee
              Participants of an Issue:
              0 Vote for this issue
              1 Start watching this issue




                  Version Package