代码之家  ›  专栏  ›  技术社区  ›  Nicolas Raoul

@启动组件时未调用激活

  •  3
  • Nicolas Raoul  · 技术社区  · 7 年前

    Liferay's documentation about making modules configurable

    @Component(configurationPid = "myproject.api.TranslationConfiguration")
    public class TranslationServiceImpl implements TranslationService {
        private volatile TranslationConfiguration configuration;
    
        public TranslationServiceImpl() {
            log.info("TranslationServiceImpl constructor");
        }
    
        @Activate
        @Modified
        protected void activate(Map<String, Object> properties) {
            log.info("Hello from activate");
        }
    }
    

    部署时,日志仅显示:

    TranslationServiceImpl constructor
    Service registered.
    STARTED myproject.impl_1.0.0 [538]
    

    为什么是 activate 方法未调用?

    重新启动Gogo Shell中的模块不会调用 使活动 任何一个

    1 回复  |  直到 7 年前
        1
  •  4
  •   Christian Schneider    7 年前

    如果你想马上开始使用 immediate=true