UserService dependency injection from portal-spring.xml

thumbnail
490292, módosítva 18 év-val korábban New Member Bejegyzések: 10 Csatlakozás dátuma: 2008.02.18. Legújabb bejegyzések
Hi,

I'd like to write a customized UserService for my portlet application. The service needs Liferay's UserService or UserLocalService. To autowire the dependencies I need a bean for it in my applicationContext. I found out that UserService is described in Liferay's portal-spring.xml, so Spring should resolve it with the following config in my web.xml (have not tried it yet):


	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/context/my-web-context.xml,classpath:my-service-context.xml,
		  classpath:portal-spring.xml</param-value>
	</context-param>
	<listener>
		<description>Spring initialization</description>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>


I think this will cause multiple contexts (the liferay context and my context). In other forum messages SpringUtil is used to retrieve the liferay context.

So what's recommend?

Regards
Dennis
thumbnail
490292, módosítva 18 év-val korábban New Member Bejegyzések: 10 Csatlakozás dátuma: 2008.02.18. Legújabb bejegyzések
Found another easy way: I used spring's factory-bean and factory-method attributes to retrieve a UserLocalService instance from UserLocalServiceFactory.getService().