Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Abhi Ed
creating hook for StartupAction in liferay
November 7, 2012 10:02 PM
Answer

Abhi Ed

Rank: Regular Member

Posts: 118

Join Date: June 4, 2012

Recent Posts

Hello friends ,

I have a requirement to create a hook for StartupAction for adding a custom field to User table in liferay .
But, i have only created hooks with jsp files. Can anyone tell me the steps for creating hook in this case ?
And where can I find that file StartupAction .java ?

Regards
Ed
Antoine Comble
RE: creating hook for StartupAction in liferay
June 14, 2013 1:31 PM
Answer

Antoine Comble

Rank: Regular Member

Posts: 221

Join Date: September 7, 2012

Recent Posts

Hi,

You can override this properties in portal.properties :
 1
 2# Global startup event that runs once when the portal initializes.
 3#
 4global.startup.events=com.liferay.portal.events.GlobalStartupAction
 5
 6
 7# Application startup event that runs once for every web site instance of
 8# the portal that initializes.
 9#
10application.startup.events=com.liferay.portal.events.AppStartupAction

After doing this, you create a class like com.liferay.portal.events.AppStartupAction and when liferay starts up, your code will be executed.

To hook portal.properties, in your liferay-hook.xml add this :
1
2<portal-properties>portal.properties</portal-properties>


The, create a portal.properties file in project classpath and should be work.

Antoine