THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
Deprecated | ||||
---|---|---|---|---|
| ||||
...
You can then contribute into the Infrastructure service's configuration:
Code Block | ||||
---|---|---|---|---|
| ||||
public static void contributeAlias(@InjectService("MyService") MyService myService, Configuration<AliasContribution> configuration) { configuration.add(AliasContribution.create(MyService.class, myService)); } |
...
Notice that the contribution doesn't _have_ to be a service; you can just instantiate an object inside the contribution method and contribute that. That's what we're doing in the example, though we're using a create() static method rather than *new* (just to smooth out some Java Generics ugliness).
...