Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Sisu/Techniques"
< Sisu
(Adding an example of expanding the basic example) |
m (→How to add specific bindings to the basic example) |
||
Line 1: | Line 1: | ||
− | == How to add specific bindings to the basic example == | + | == How to add specific bindings to the basic Sisu example == |
Here is an expanded version of the 'getting started' tutorial that adds an additional module | Here is an expanded version of the 'getting started' tutorial that adds an additional module |
Revision as of 22:33, 31 January 2014
How to add specific bindings to the basic Sisu example
Here is an expanded version of the 'getting started' tutorial that adds an additional module to publish some scalar parameters.
public static BusBootstrap Main(final String[] cliArguments, final String configFilePathname) { ClassLoader classloader = BusBootstrap.class.getClassLoader(); AbstractModule parameterModule = new AbstractModule() { @Override protected void configure() { // Add EDSL binding calls here. } @Provides @Parameters String[] cliArguments() { return cliArguments; } @Provides @Parameters WsBusConfig config() { return new WsBusConfig(configFilePathname); } }; Injector injector = Guice.createInjector( parameterModule, new WireModule(// auto-wires unresolved dependencies new SpaceModule(// scans and binds @Named components new URLClassSpace(classloader) // abstracts class/resource finding ))); return injector.getInstance(BusBootstrap.class); }