Accepted Solutions (1)

Accepted Solutions (1)




Using interfaces is a good practice to decouple the user of a service from the implementation. In many cases you even want to have an API bundle so the user of the service does not need a maven dependency to the implementing bundle.On the other hand, you are not required to use interfaces. Especially when u wire components inside a bundle interfaces,it is often an unnecessary layer. In this case simply export the service directly with the class.

@Component(service = AbcService.class)

public class AbcService {

for client code

private AbcService abcService;

So the difference is that you have to specify the service property if you want to export a component with its implementation class.

Answers (0)