Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: How to Inject OSGi Dependencies in Custom Portlets in Liferay 7.1
I create 2 modules using Gradle-based Liferay projects ( moduleA and moduleB )
moduleB is a dependency for moduleA
And it works correctly
I can correctly call methods of moduleB in moduleA
But when make any change in moduleB methods, changes not applied after deploy
moduleB is a dependency for moduleA
And it works correctly
I can correctly call methods of moduleB in moduleA
But when make any change in moduleB methods, changes not applied after deploy
Attachments:
Do you deploy module B?
How do you inject module B into module A? Or how do you instance it? Can you show a minimal example?
How do you inject module B into module A? Or how do you instance it? Can you show a minimal example?
Hi
Yes
After the settings I sent as an attachment in the previous post, i make an ordinary object and call my method
any change in moduleB methods not applied after deploy
Module B has the same behavior as before
but after deploy, i remove modules using telnet and then redeploy modules, it will be correct!!!
Yes
After the settings I sent as an attachment in the previous post, i make an ordinary object and call my method
any change in moduleB methods not applied after deploy
Module B has the same behavior as before
but after deploy, i remove modules using telnet and then redeploy modules, it will be correct!!!
ali yeganeh:
OSGi only will update @Reference(s) to @Component(s). If you introduce dependencies yourself, e.g. through instanciating an object, OSGi won't magically deploy (and garbage collect) a bundle as long as there are still references to it.
After the settings I sent as an attachment in the previous post, i make an ordinary object and call my method
any change in moduleB methods not applied after deploy
Module B has the same behavior as before
but after deploy, i remove modules using telnet and then redeploy modules, it will be correct!!!
I'm assuming that you're instantiating the object from module B yourself. Don't do that. If you let OSGi do the dependency management, it'll automatically restart the required modules.
Hi Mr. Olaf Kock
You gave the perfect answer
Thank you very much
You gave the perfect answer
Thank you very much
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™