Chapter 4: Data Access with #SpringBoot on the move /cc @PacktPub

learning-spring-boot-ch-4I’ve gotten things moving quickly with chapter 4 of Learning Spring Boot. The general idea is that I want to show how to get off the ground super fast using Spring Boot and H2 as an in-memory database. Give the user the tools to either load up some sample data with a SQL script or with the Spring Data APIS. And then from there, see how to transition to production data.

You see, a common problem people deal with is building code on their development workstation and wanting to write unit tests. But the database is a fixed source of data. What do you do? Wipe it clean before every test run? What about other developers? That’s where in-memory, local database really shine. They are fast, have zero setup, and when you shutdown the test app or test case, everything is clean.

So using that to write code, test cases, etc., is great. But eventually, you have to switch over to pointing at a development database, perhaps a test bed database, and ultimately, a production database. Your app shouldn’t have to go through crazy gyrations and edits to move between those different environments.

And that’s the story I want to tell in this chapter. Spring Boot + Spring Data + Spring Framework makes this so incredibly easy. It’s a problem I ran into several times in the past, and with the über awesome power of Spring Boot+Data+Framework, I want to show my readers that there is no reason to fear the multi-environment database setup!

Leave a Reply

Your email address will not be published. Required fields are marked *