use of ninja.jpa.JpaModule in project ninja by ninjaframework.
the class NinjaDaoTestBase method initialize.
@Before
public final void initialize() {
NinjaPropertiesImpl ninjaProperties = new NinjaPropertiesImpl(ninjaMode);
injector = Guice.createInjector(new JpaModule(ninjaProperties));
jpaInitializer = injector.getInstance(JpaInitializer.class);
jpaInitializer.start();
}
use of ninja.jpa.JpaModule in project ninja by ninjaframework.
the class NinjaClassicModule method configure.
@Override
public void configure() {
// NOTE: these are grouped to line up with third-party dependencies
// (e.g. jackson supports templates & body parsers)
// Text & post require no 3rd party libs
bind(TemplateEngineText.class);
bind(BodyParserEnginePost.class);
// Freemarker
if (freemarker) {
bind(TemplateEngineFreemarker.class);
}
// Jackson json support
if (json) {
OptionalBinder.newOptionalBinder(binder(), ObjectMapper.class).setDefault().toProvider(ObjectMapperProvider.class).in(Singleton.class);
bind(TemplateEngineJson.class);
bind(TemplateEngineJsonP.class);
bind(BodyParserEngineJson.class);
}
// Jackson xml support
if (xml) {
OptionalBinder.newOptionalBinder(binder(), XmlMapper.class).setDefault().toProvider(XmlMapperProvider.class).in(Singleton.class);
bind(TemplateEngineXml.class);
bind(BodyParserEngineXml.class);
}
// Postoffice
if (postoffice) {
bind(Postoffice.class).toProvider(PostofficeProvider.class);
}
// Cache
if (cache) {
bind(Cache.class).toProvider(CacheProvider.class);
}
// Migrations
if (migrations) {
bind(MigrationEngine.class).toProvider(MigrationEngineProvider.class);
bind(MigrationInitializer.class).asEagerSingleton();
}
// JPA
if (jpa) {
install(new JpaModule(ninjaProperties));
}
}
Aggregations