

This allows us to immediately increase our productivity when we’re working against some actual data, we can see straightaway our sorting and filtering behaves as expected. Thanks to mockaroo, we can produce fictitious sample data to pre-populate our customer table. is not enough, we don’t want blank space to be entered either. We’ve added two Validation Constraints against the first and last name fields. We’ve set the GenerationType on the Id field to GenerationType.IDENTITY, rather than GenerationType.AUTO as H2 will otherwise have a problem generating the next number in the sequence when we attempt to save a new record. public getters and setters omitted for brevity class Customer = GenerationType.IDENTITY) So let’s take a look at our Custom domain. This is enough to demonstrate how to enforce validation, and how to present errors back to the user using Thymeleaf templates. We’ll apply a minimal set of validation rules just to ensure the customer record will also have a first and last name. We’re going to focus on a single database backed entity in this article, a Customer, the C in CRM. As per the image below, I have selected:Ĭlick next and define where your project will reside and we can begin looking at the necessary code to make all this work. Hit Next where we’ll select our initial dependencies. For dependency management, my personal preference is Gradle although feel free to use Maven if you so wish. So from within Idea, create a new project and select the Spring Boot Initializr.įor the purpose of this article, I’m going to write all code for this web application in pure Java.

IntelliJ has a nice interface to Spring Initializer that we can use to intialise our project. Let’s get started and build a Spring Boot CRM. I’m going to use IntelliJ Idea as my IDE of choice, a H2 in-memory database with 1000 fictitious records, Spring Boot and Thymeleaf templating engine.Īll source code can be found on our Tucanoo Github repository. Results should also be paginated so we’re not returning the entire database but rather a short subset of paged results.
