Forums de discussion

RE: osgi spring context

thumbnail
David H Nebinger, modifié il y a 7 années.

RE: osgi spring context

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes
Spring and OSGi are not comingled as you seem to think.

OSGi exposes a bundle and the DS services provided by the bundle, but it will not expose a spring context or instantiated spring beans in that context because they are only visible within that bundle, within that internal spring context.

Liferay has the spring extender which is like a bridge to expose spring beans as OSGi services, but you'd have to conform to Liferay's Spring implementation to take advantage of it.
thumbnail
Manish Jha, modifié il y a 6 années.

RE: osgi spring context

Junior Member Publications: 50 Date d'inscription: 07/02/13 Publications récentes
do you have any example code that uses spring in liferay ?
thumbnail
Petr Jung, modifié il y a 5 années.

RE: osgi spring context

New Member Publications: 11 Date d'inscription: 16/01/19 Publications récentes

Hi David H

I have seen the Liferay Spring OSGi extender, but this provide the Liferay Spring version. This is on classpath as a first, no way to put there myne version.

Do you know, if it is possible to attach another Spring extender, which provide my version of Spring. If yes, how to mark which modules should be extended by original Liferay Spring extender a which modules you my version of an extender.

Petr Jung

thumbnail
David H Nebinger, modifié il y a 5 années.

RE: osgi spring context

Liferay Legend Publications: 14919 Date d'inscription: 02/09/06 Publications récentes

Hey, Petr!

 

If you are using Spring MVC, just continue to bundle as a portlet war.  Your spring context will still be maintained and you can use whatever version of Spring you want to plus you can get access to the underlying OSGi components too if you need to.

If you try to use the Liferay Spring extender, then you're stuck with Liferay's version of Spring.  Rolling your own extender wouldn't really work to well because the extender processes the embedded spring context files and adds the beans to the Liferay context; trying to create an extender that used a different version of spring would not have the outcome you're hoping for.