Search in sources :

Example 1 with CrnkFeature

use of io.crnk.rs.CrnkFeature in project crnk-framework by crnk-project.

the class DropwizardService method run.

@Override
public void run(DropwizardConfiguration dropwizardConfiguration, Environment environment) throws Exception {
    // here we make use of a module as example instead of using service discovery (CDI, Spring, etc.)
    // tag::docs[]
    SimpleModule module = new SimpleModule("example");
    module.addRepository(new ProjectRepository());
    CrnkFeature crnkFeature = new CrnkFeature();
    crnkFeature.addModule(module);
    environment.jersey().register(crnkFeature);
// end::docs[]
}
Also used : ProjectRepository(io.crnk.example.dropwizard.simple.domain.repository.ProjectRepository) CrnkFeature(io.crnk.rs.CrnkFeature) SimpleModule(io.crnk.core.module.SimpleModule)

Example 2 with CrnkFeature

use of io.crnk.rs.CrnkFeature in project crnk-framework by crnk-project.

the class DropwizardService method run.

@Override
public void run(DropwizardConfiguration dropwizardConfiguration, Environment environment) throws Exception {
    environment.lifecycle().manage(guiceBundle.getInjector().getInstance(MongoManaged.class));
    CrnkFeature crnkFeature = new CrnkFeature();
    crnkFeature.getBoot().setObjectMapper(environment.getObjectMapper());
    crnkFeature.getBoot().setServiceDiscovery(new GuiceServiceDiscovery(guiceBundle.getInjector()));
    environment.jersey().register(crnkFeature);
}
Also used : GuiceServiceDiscovery(io.crnk.guice.GuiceServiceDiscovery) CrnkFeature(io.crnk.rs.CrnkFeature) MongoManaged(io.crnk.example.dropwizard.mongo.managed.MongoManaged)

Aggregations

CrnkFeature (io.crnk.rs.CrnkFeature)2 SimpleModule (io.crnk.core.module.SimpleModule)1 MongoManaged (io.crnk.example.dropwizard.mongo.managed.MongoManaged)1 ProjectRepository (io.crnk.example.dropwizard.simple.domain.repository.ProjectRepository)1 GuiceServiceDiscovery (io.crnk.guice.GuiceServiceDiscovery)1