Last active
September 6, 2023 14:41
-
-
Save marcosblandim/cf9d4e8911fa7cddab38402c9b77cda4 to your computer and use it in GitHub Desktop.
Liferay: Get OSGi Service in Groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.liferay.registry.Registry | |
import com.liferay.registry.RegistryUtil | |
import com.liferay.registry.ServiceReference | |
def getService(Class clazz) { | |
Registry registry = RegistryUtil.getRegistry(); | |
ServiceReference serviceReference = registry.getServiceReference(clazz); | |
return registry.getService(serviceReference); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment