Package org.qi4j.bootstrap

Examples of org.qi4j.bootstrap.SingletonAssembler.module()


                throws AssemblyException
            {
                assembly.transients( Speaker.class );           // <2>
            }
        };
        Speaker speaker = assembler.module().newTransient( Speaker.class ); // <3>
        System.out.println( speaker.sayHello() );
    }
}
// END SNIPPET: documentation
View Full Code Here


                module.entities( TestEntity.class ).withConcerns( DomainEventCreationConcern.class );
            }
        };

        component.getDefaultHost().attach( "/events", new TestApplication( assembler ) );
        component.getDefaultHost().attach( "/ping", assembler.module().newObject( PingResource.class ) );
        component.start();

        generateTestData(assembler.module());
    }
View Full Code Here

        component.getDefaultHost().attach( "/events", new TestApplication( assembler ) );
        component.getDefaultHost().attach( "/ping", assembler.module().newObject( PingResource.class ) );
        component.start();

        generateTestData(assembler.module());
    }

    private static void generateTestData(UnitOfWorkFactory unitOfWorkFactory) throws UnitOfWorkCompletionException
    {
        // Set principal for the UoW
View Full Code Here

                new SpringImporterAssembler( appContext ).assemble( module );
            }
        };

        assembler.module().injectTo( this );

        assertThat( "service can be called", service.comment( "beer" ), equalTo( "beer is good." ) );
    }

    @Service Iterable<ServiceReference<CommentService>> services;
View Full Code Here

                new SpringImporterAssembler( appContext ).assemble( module );
            }
        };

        assembler.module().injectTo(this);

        CommentService service = firstService( withId( "commentService2" ), services );
        assertThat( "service with correct id has been selected", service.comment( "pizza" ), equalTo( "pizza is good." ) );
    }
View Full Code Here

                new SpringImporterAssembler( appContext ).assemble( module );
            }
        };

        assembler.module().injectTo( this );

        CommentService foundService = ServiceQualifier.firstService( withId( "commentService2" ), finder.<CommentService>findServices( CommentService.class ));
        assertThat( "service with correct id has been selected", foundService.comment( "pizza" ), equalTo( "pizza is good." ) );
    }
}
View Full Code Here

            {
                module.transients( MyComposite.class );
            }
        };

        MyComposite composite = assembly.module().newTransient( MyComposite.class );

        composite.doStuff();
        composite.doStuff();
        composite.doStuff2();
        composite.doStuff3();
View Full Code Here

                new FileConfigurationAssembler().assemble( module );
                // END SNIPPET: simple
            }
        };

        FileConfiguration config = assembler.module().findService( FileConfiguration.class ).get();

        File confDir = config.configurationDirectory();
        System.out.println( confDir );
    }
View Full Code Here

                new FileConfigurationAssembler().withOverride( override ).assemble( module );
                // END SNIPPET: override
            }
        };

        FileConfiguration config = assembler.module().findService( FileConfiguration.class ).get();

        assertEquals( testFile.getAbsolutePath(), config.configurationDirectory().getAbsolutePath() );
    }
}
View Full Code Here

                } );
            }

        };

        Module module = assembler.module();

        // START SNIPPET: io
        // Look up the DataSource
        DataSource ds = module.findService( DataSource.class ).get();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.