【问题标题】:Overriding Liferay Startup Events覆盖 Liferay 启动事件
【发布时间】:2012-04-27 15:55:01
【问题描述】:

我有一个关于 Liferay 启动活动的问题。

在 Liferay 文档中给出:

启动事件

输入以逗号分隔的扩展com.liferay.portal.struts.SimpleAction 的类名列表。这些类将在指定的事件中运行。

谁能告诉我global.startup.eventsapplication.startup.events 之间的区别是什么?谁能告诉我在什么情况下我们需要覆盖它们?

这两个启动事件都应该扩展com.liferay.portal.struts.SimpleAction吗?我在SimpleAction 中找不到任何东西,除了这个:

public abstract class SimpleAction {

    public abstract void run(String[] ids) throws ActionException;

    }
}

我也想知道这个类什么都不包含,Liferay 怎么知道要读取和处理哪些 XML 文件?

谢谢

【问题讨论】:

    标签: events liferay startup


    【解决方案1】:

    global.startup.events - 为全局服务器运行一次

    application.startup.events - 在启动时为每个门户实例运行。如果您的服务器上有一个门户实例(正常情况) - 此属性之间没有区别。我用application.startup.events

    扩展com.liferay.portal.kernel.events.SimpleAction 类并实现run-方法,该方法将由liferay 启动调用。为此,创建一个钩子插件并在 liferay-hook.xml 中注册属性文件,例如:

    <hook>
        <portal-properties>portal-myext.properties</portal-properties>
    </hook>
    

    在类路径中创建portal-myext.properties 并设置您的启动操作:

    application.startup.events=com.my.actions.MyStartupAction
    

    动作MyStartupAction 必须在同一个类路径中,因此是同一个钩子插件。

    【讨论】:

    • @user1253847 那么你为什么不接受这个作为答案呢?谢谢
    猜你喜欢
    • 2016-05-31
    • 2012-12-29
    • 2011-08-26
    • 1970-01-01
    • 1970-01-01
    • 2014-09-02
    • 1970-01-01
    • 2021-07-28
    • 1970-01-01
    相关资源
    最近更新 更多