RE: Can I inject custom module reference in FinderImpl ????

Prathibha h m, modified 5 Years ago. Junior Member Posts: 74 Join Date: 9/17/09 Recent Posts
I have a custom module which has some util classes which I need to use in my FinderImpl , is it a good way to inject the util class into FinderImpl, Please do share example if you have.custom module is exporting util class.FinderImpl gradle has dependency added .
but I get reference as null. 

@Component(service = SampleFinder.class)
public class SampleFinderImpl extends SampleFinderBaseImpl implements SampleFinder {
//Methods....@Reference
    private MathUtil  _MathUtil;
}
-----------------------In finder gradle-----------compileOnly project(":modules:abc:com.test.first.util")
------------------------------------------------------in  util package - bnd.bnd.Export-Package: com.test.first.util
thumbnail
Minhchau Dang, modified 5 Years ago. Liferay Master Posts: 598 Join Date: 10/22/07 Recent Posts
Is your service builder service created using Spring DI or is it created with OSGi DS?
https://help.liferay.com/hc/en-us/articles/360032624732-Migrating-a-Service-Builder-Module-from-Spring-DI-to-OSGi-DS
Given your code, there will be one instantiated by DS, and it will have a non-null reference, but if there is another one instantiated by Spring DI, its reference won't be populated.