An alternative way of tagging components for iPOJO is to annotate them directly in the Java code. iPOJO provides annotations support through the
There are some gains in clarity of the code when using annotations and it also simplifies updates by keeping the configuration closer to its target class or field.
For instance, in the previous declaration of the bookshelf service, we could have replaced the configuration entry in the
<component classname= "com.packtpub.felix.bookshelf.service.impl.BookshelfServiceImpl" name="BookshelfServiceImpl"> <provides /> <requires field="inventory" /> </component>
With annotations to the class