My First Full Stack Spring Boot / JQuery Application

Part 2 - Creating a Repository / Config

Create Repository

public interface PersonRepository extends CrudRepository<Person, Long> {
}

Prepopulate The Entity

@Configuration
public class PersonConfig {
    @Autowired
    private PersonRepository repository;

    @PostConstruct
    public void setup() {
        Person person1 = new Person();
        person1.setFirstName("Leon");
        person1.setLastName("Hunter");

        Person person2 = new Person();
        person2.setFirstName("John");
        person2.setLastName("Doe");

        repository.saveAll(Arrays.asList(
                person1,
                person2
        ));
    }
}