From the course: Extending, Securing, and Dockerizing Spring Boot Microservices

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Define the schema and default data

Define the schema and default data

From the course: Extending, Securing, and Dockerizing Spring Boot Microservices

Start my 1-month free trial

Define the schema and default data

- [Instructor] In software development, many times the best choice when writing code is to not write the code at all. We are constantly standing on the shoulders of others to advance our own application. Don't reinvent the wheel for crying out loud. An example of this is how explorecali initializes the in-memory database. It instantiates and saves all the tour packages in explorecali application. Then it opens a .JSON file and marshals each entry into a Tour object. And then saves the Tour package. This was done in order to demonstrate the Spring Data repository save and find methods. But there was a better way. Thanks to Spring Data repository initialization. Let's go to the resources folder and schema.sql. This is a file that has SQL commands in it. And it will create the schema. In other words, it will actually create the database tables. And then data.sql. This is where we insert rows into those tables. And…

Contents