Bootstrapping Some Test Data
To get a better feel for how TekDays is coming along, we can enter some data and check out the various views. We’ve seen the list and create views, but there’s also the show and edit views.
The problem with entering test data now is that it would all be lost as soon as we restarted the application. We’re working with an in-memory database at this point. Eventually, we will point TekDays at a real database, but for now, the in-memory H2 database is pretty handy—that is, it would be if we didn’t lose our data.
This dilemma’s answer is in TekDays/grails-app/conf/BootStrap.groovy. The file has an init code block, which is executed by our application at start-up. If we create TekEvent instances there, they will be ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access