...
Trying to create an OSGi-based application with services is challenging. The OSGi API is complex and a lot of knowledge about internal mechanisms has to be known to avoid synchronization issues. iPOJO provides a very simple development model; let's look:
Code Block |
---|
| java |
---|
| java |
---|
1 | Providing a servicejava |
---|
|
@Component
@Provides
public class MyServiceImplementation implements MyService {
//....
}
|
Code Block |
---|
| java |
---|
| java |
---|
1 | Requiring a servicejava |
---|
|
@Component
public class MyServiceConsumer {
@Requires
private MyService myservice;
// Just use your required service as any regular field !
}
|
...