-
Notifications
You must be signed in to change notification settings - Fork 180
Field Validation
Taylor Wicksell edited this page May 2, 2017
·
5 revisions
Removed as of v1.17.0 as this feature was rarely used internally
Governator supports JSR 303 – Bean Validation by passing injected instances through the Hibernate Validator library.
All validation errors are thrown as the Governator exception: ValidationException
Example:
@Min(5)
private int myInt; // ValidationException is thrown if this is less than 5
Validation is performed when LifecycleManager.start()
is called.
NOTE: You can combine validation, Auto Bind, Configuration, etc. annotations. E.g.
@Max(10)
@Configuration("my.config")
@AutoBind
@Inject
private int myConfig = DEFAULT_VALUE;
- Home
- Getting Started
- Bootstrapping
- Lifecycle Management
- Auto Binding
- Module-Dependencies
- Warm Up
- Configuration Mapping
- Field Validation
- Lazy Singleton
- Concurrent Singleton
- Generic Binding Annotations
- LifecycleListener
- Governator Phases
- Grapher Integration
- JUnit Testing
- FAQ
- Best Practices
- Spring, PicoContainer, Etc.
- Javadoc
- End-to-End Examples