Dropwizard guice integration
DOCUMENTATION: http://xvik.github.io/dropwizard-guicey/
Additional repositories:
Support:
About
Dropwizard 1.1.0 guice (4.1.0) integration.
Originally inspired by dropwizard-guice and dropwizardy-guice (which was derived from first one).
Features:
- Guice injector created on run phase
- Compatible with guice restrictive options:
disableCircularProxies
,requireExactBindingAnnotations
andrequireExplicitBindings
- Flexible HK2 integration
- No base classes for application or guice module (only bundle registration required)
- Configurable installers mechanism: each supported feature (task install, health check install, etc) has it's own installer and may be disabled
- Custom feature installers could be added
- Optional classpath scan to search features: resources, tasks, commands, health checks etc (without dependency on reflections library)
- Injections works in commands (environment commands)
- Support injection of Bootstrap, Environment and Configuration objects into guice modules before injector creation
- Guice ServletModule can be used to bind servlets and filters for main context (may be disabled)
- Dropwizard style reporting of installed extensions
- Admin context rest emulation
- Custom junit rule for lightweight integration testing
- Spock extensions
Thanks to
- SĂ©bastien Boulet (intactile design) for very useful feedback
- Nicholas Pace for governator integration
Setup
Releases are published to bintray jcenter (package appear immediately after release) and then to maven central (require few days after release to be published).
May be used through extensions project BOM or directly.
Maven:
<dependency>
<groupId>ru.vyarus</groupId>
<artifactId>dropwizard-guicey</artifactId>
<version>4.1.0</version>
</dependency>
Gradle:
compile 'ru.vyarus:dropwizard-guicey:4.1.0'
Dropwizard | Guicey |
---|---|
1.0 | 4.0.1 |
0.9 | 3.3.0 |
0.8 | 3.1.0 |
0.7 | 1.1.0 |
BOM
Guicey pom may be also used as maven BOM:
plugins {
id "io.spring.dependency-management" version "1.0.2.RELEASE"
}
dependencyManagement {
imports {
mavenBom 'ru.vyarus.guicey:guicey:4.1.0'
}
}
dependencies {
compile 'ru.vyarus.guicey:guicey:4.1.0'
// no need to specify versions
compile 'io.dropwizard:dropwizard-auth'
compile 'com.google.inject:guice-assistedinject'
testCompile 'io.dropwizard:dropwizard-test'
testCompile 'org.spockframework:spock-core'
}
Bom includes:
- Dropwizard BOM (io.dropwizard:dropwizard-bom)
- Guice BOM (com.google.inject:guice-bom)
- Hk bridge (org.glassfish.hk2:guice-bridge)
- System rules, required for StartupErrorRule (com.github.stefanbirkner:system-rules)
- Spock (org.spockframework:spock-core)
Guicey extensions project provide extended BOM with guicey and all guicey modules included. See extensions project BOM section for more details of BOM usage.
Snapshots
You can use snapshot versions through JitPack:
- Go to JitPack project page
- Select
Commits
section and clickGet it
on commit you want to use (top one - the most recent) - Follow displayed instruction: add repository and change dependency (NOTE: due to JitPack convention artifact group will be different)
Usage
Read documentation
Might also like
- generics-resolver - runtime generics resolution
- guice-validator - hibernate validator integration for guice (objects validation, method arguments and return type runtime validation)
- guice-ext-annotations - @Log, @PostConstruct, @PreDestroy and utilities for adding new annotations support
- guice-persist-orient - guice integration for orientdb
- dropwizard-orient-server - embedded orientdb server for dropwizard