This answer actually shows a better approach and should be the accepted one.
You can put something like this in src/main/resources/data.sql
:
INSERT INTO users (firstname, password, enabled)
SELECT 'admin', 'secret', TRUE
WHERE NOT EXISTS (SELECT * FROM users WHERE firstname='admin');
Assuming you are using PostgreSQL for the database backend.
As I don't know the database schema you are using, you'll have to modify this query to match your schema, but it should give you the basic idea.
I think you don't even need to add any configuration for this to work as Spring will pick it up automatically and use it for database initialization if it's in the right directory.
According to another answer to a similar question, in Spring Boot 2.x you'll have to add the following piece of configuration for this to work:
spring.datasource.initialization-mode=always