Antonio Goncalves, fellow JCP member and friend has asked me why Bean Validation XML's namespace has not moved from its original location to the jcp.org location like other Java EE 7 specifications.
I don't remember being aware that such a move was orchestrated so there are two possible reasons:
- I was never been made aware of the move,
- I was aware of it but considered that it was low priority compared to the other issues we were working on.
Provided we had to work hard till the last minute, and that the community never was keen on the XML support we put in Bean Validation, #2 is not impossible but I suspect it's #1 or I would have opened an issue to track the task.
Anyways, that's not a problem. Anyone can open an issue (I've just created one for this task), write a couple of pull requests to fix the spec, TCK and RI as explained in our contribute section. Scratch your own itch: so who's jumping? :)
We will have to wait for the next version of the spec to avoid breaking older applications but if it's committed, it won't be forgotten.
PS: no, I'm not bitter, but since I haven't blogged in a while that was a good occasion to remind everyone of the power of contributions ;)
It's now official, these couple of years of work have made it into an official JCP specification. Bean Validation is also part of Java EE 7 which has been approved too a few of days ago.
We have already discussed the features at great length here but to do a short summary:
- support for method and constructor validation (via CDI, JAX-RS etc)
- integration with CDI (
Validator
andValidatorFactory
injectable,ConstraintValidator
instances being CDI beans and thus accept@Inject
, etc) - EL expressions based error messages
- group conversion in object graphs
I would like to thank the expert group and the community at large (without your input there would be no 1.1), Hardy and Gunnar that worked round to clock on the spec, the RI and the TCK and deliver everything on time, Pete for being my springboard when all hell broke lose and the folks at Oracle who worked with us to integrate Bean Validation with the rest of the Java EE ecosystem whether it be spec, implementation or TCK.
Go grab Hibernate Validator, the RI. The team has even spent an extra couple of weeks to deliver a nice documentation. And if you can't sleep, go read the specification itself.
Bean Validation, Hibernate Validator (its Reference Implementation) and the Test Compatibility Kit have been handed over to the JCP for what is called the Final Approval Ballot. That's when the expert committee votes for the go / no-go of the specification going final as it is.
We have found a few glitches when working on both the RI and the TCK in the
last month but everything is in order now. The biggest visible change for you
is that we renamed @ValidateExecutable
into @ValidateOnExecution
and we added a
way to disable method validation entirely via the XML deployment descriptor.
We worked hard to make a stellar TCK. Let's speak numbers: the specification has 549 assertions including 492 testable. We cover 98,8% of them with 1500 tests. Good luck to all future Bean Validation 1.1 implementors :)
Everything is already available for you to use:
Enjoy!
Our Proposed Final Draft has been officially handed over to the JCP last night.
After a frantic month of work culminating with two weeks of monomaniac focus, we are finally handing over the Bean Validation 1.1 Proposed Final Draft to the JCP. Of course everything is open source so you can get it too:
- the spec
- the JavaDoc
- and the API JAR: maven coordinates javax.validation:validation-api:1.1.0.CR1
What's new in Bean Validation 1.1?
The specification highlights very well the main features of this version but to summarize them:
- work done entirely in the open
- support for dependency injection and better integration with CDI
- support for method and constructor validation
- support for group conversion when cascading
- support for EL based message interpolation
What's different between Beta 4 and CR 1?
We did a lot of polishing and nailed a lot of remaining corner cases. Here is a few of the tasks we worked on:
- rework of the JavaDoc
- move to
@SupportValidationTarget
onConstraintValidator
instead of the additional@CrossParameterConstraint
on the constraint to mark a constraint as cross-parameter - many more examples in the specification
- improve node creation logic when nodes are added programmatically
- improve the creation logic of custom nodes when using the programmatic API of
ConstraintViolationBuilder
in aConstraintValidator
And of course many hours rereading the specification to find holes and fix them.
Review
Hibernate Validator 5.0.0.CR1 and the TCK should be here any minute. Help us make this spec as good as possible by reviewing it and opening issues where it itches you.
You can access the specification here. All changes are marked with a different color. Green for additions, yellow for changes. This will help you see what has changed precisely.
Please send us your remarks and comments:
- on our mailing list
- in our issue tracker
- or on the Bean Validation forum
Many many thanks to my partners in crime Hardy and Gunnar that worked around the clock with me to deliver this proposed final draft right on time but with no compromise on quality.
Our proposed final draft is due soon but we did one last drop of the specification and the API jar. We worked all over the board (and the clock) but the most notable improvements are:
Improvements on the CDI integration section
We made it much more descriptive of the expected behavior instead of imposing an implementation pattern. We have also added the method and constructor interception priority as defined in the Java EE specification and the interceptor specification in particular.
Thanks Pete for your help.
Remove the link between the Node API and the metadata API
This is something we could not make work, so we fall back into a more redundant but we think cleaner design. We also made the node builder API easier to use despite the increased number of node types.
//Cross-parameter constraint on a method
//mergeAddresses(Map<String,Address> addresses, Map<String,Address> otherAddresses)
//Build a constraint violation on the default path + "otherAddresses["home"]
//ie. the Address bean hosted in the "home" key of the "otherAddresses" map parameter
context.buildConstraintViolationWithTemplate(
"Map entry home present in both and does not match")
.addParameterNode(1)
.addBeanNode()
.inIterable().atKey("home")
.addConstraintViolation();
Clarification around method validation (metadata, cross-parameter, reports)
We now have an explicit cross-parameter concept materialized in the metadata
API. It makes for a more regular and easier to browse API.
ConstraintViolation
has also seen some improvements and adaptations to make
it ready for prime - method validation - time.
Mark a method as (non) validated
We slightly improved @ValidateExecutable
to be more friendly when
put on a specific method. To force a getter to be validated or to
force a method to not be validated is now more readable.
public class Operations {
@ValidateExecutable
@Status
public String getStatus() { ... }
@ValidateExecutable(ExecutableType.NONE)
public void apply(@Valid Operation operation) { ... }
}
Review
Let us know what you think.
You can access the specification here. All changes are marked with a different color. Green for additions, yellow for changes and struck through red for removals . This will help you see what has changed precisely.
Please send us your remarks and comments:
- on our mailing list
- in our issue tracker
- or on the Bean Validation forum
If you want to go to the next step and contribute, send us an email to the mailing list and read how to contribute.
Latest news
Stay up to date, subscribe to the news feed.