THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Declaring component types
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<component
classname="my.Implementation"
name="my-type"
>
</component>
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@Component(name="my-type") public class Implementation { // ... } |
...
...
Creating component instances
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<instance component="my-type"/> <instance component="my.Implementation"/> <instance component="my-type" name="my-instance"/> <instance component="my-type" name="my-instance"> <property name="property1" value="value1"/> </instance> |
...
- Instances can contains a configuration given under the
key-value
form. Properties can also by complex type. - How-to use iPOJO factories
...
Providing services
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<component classname="my.service.implementation" name="my-service-impl"> <provides/> </component> <instance name="my-service-impl"/> |
...
Center |
---|
...
Using services with field injection
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<component classname="my.consumer.Implementation">
<requires field="fs" />
</component>
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@Component public class Dependency { @Requires public FooService fs; //... } |
Center |
---|
Using services with method injection
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<component classname="my.consumer.Implementation">
<requires>
<callback type="bind" method="bind" />
<callback type="unbind" method="unbind" />
</requires>
</component>
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@Component public class Dependency { @Requires@Unbind public FooService fs; @Unbind public synchronized void unbind(BazService bz) { //... } @Bind public synchronized void bind(BazService bz) { // ... } //... } |
...