Bean Validation (JSR303) is a great way to verify that you receive valid data from all sorts of input. You have several baked in options such as @NotNull and @Min. However you will invariably come across the need to implement your own annotation for some custom validation. The following classes accomplish this task:
There are posts out there that help you serve up files using Spring MVC. A few of these instruct to serve down a byte array by using something like Files.readAllBytes(path); This works great for small files but keep in mind that doing this reads the entire file into memory, which can definitely cause problems on files of any sort of size. The following example will show you how to serve down large files one chunk at a time.
The other day I ran into a situation where I needed to use a CASE statement in both the SELECT statement as well as the GROUP BY statement in an HQL (Hibernate Query Language) string.
It is possible to accomplish this with some special syntax. This particular example is useful to group and count dated objects by the quarter of the year in which they were created.
If you want to customize the url that users are sent to after a failed login attempt when you are using the Spring Security Core plugin they have exposed this configuration string. Simple add this in your Config.groovy file: