Netflix / governator

Governator is a library of extensions and utilities that enhance Google Guice to provide: classpath scanning and automatic binding, lifecycle management, configuration to field mapping, field validation and parallelized object warmup.
Apache License 2.0
825 stars 180 forks source link

Governator Jersey-Guice integration #324

Closed elandau closed 8 years ago

elandau commented 8 years ago

Fork the jersey-guice integration to gain more control over Jersey's ResourceConfig and NOT auto-register bound classes with @Path annotations to the Jersey context.

Usage,

LifecycleInjector injector = InjectorBuilder.fromModules(
    new JerseyServletModule() {
        @Override
        protected void configureServlets() {
            install(new GovernatorJerseySupportModule());
            serve("/*").with(GovernatorServletContainer.class);
        }

        @Advises
        @Singleton
        @Named("governator")
        UnaryOperator<DefaultResourceConfig> getResourceConfig() {
            return config -> {
                Map<String, Object> props = config.getProperties();
                props.put(ResourceConfig.FEATURE_DISABLE_WADL, "false");

                config.getClasses().add(SampleResource.class);

                return config;
            };
        }
    };
}
zarfide commented 8 years ago

Like.