Can I use Grails validation outside of Grails? How?

Grails has an amazing validation; Is it possible to use it regardless of the Grails framework?

We have a Camel-based Java / Groovy web application that we cannot convert to a Grails application. I would like to use Grails style validation with declarative restrictions, but I could not successfully configure the application to work with Grails libraries without converting all this.

+4
source share
2 answers

The validation provided by Grails is just a wrapper around the Spring bean of the validation framework. Since Grails is open source, you can see how to do it and adapt it to your needs. The best place to look is GrailsDomainClassValidator and DomainClassGrailsPlugin to understand how this is done. Another interesting topic is the @Validateable annotation .

As far as I know, and from what I see in the source, there is no single way to do this outside of the Grails project without writing your own adaptation / implementation.

+4
source

. , , "jar" ( ) "lib" Grails. , API jar. , .

-1

Source: https://habr.com/ru/post/1527779/


All Articles