Hi @shoib_I ,
Indeed! It is possible, I remember in my blog I used to demonstrate through groovy console to have it shown quickly.
Here I have one example.
Let's say we have a component in AEM as below
package com.training.osgi.core.stringgen;
import org.osgi.service.component.annotations.Component;
@Component(immediate = true, service = StringGenerator.class)
public class StringGeneratorImpl implements StringGenerator {
@Override
public String generateString() {
return "Version 1.1";
}
}
You can then invoke it through groovy console as below
import com.training.osgi.core.stringgen.StringGenerator;
def service = gerService(StringGenerator.class);
println service.generateString();
You must see below output
Version 1.1
For more details please watch my published video here: https://www.techinnovia.com/osgi-services-and-components/
Hope that helps!
Regards,
Santosh