Not an managed type: class entity. & Spring Data

Your Todo class name, as shown by the error message, is entity.Todo. So it's in the package entity.

But your entity manager factory is configured this way:

entityManagerFactoryBean.setPackagesToScan("net.petrikainulainen.springdata.jpa.todo");

So your entity package is not scanned, and the Todo entity is thus unknown to JPA.


For Spring boot you must define entitymanager.packagesToScan properties in application.properties like below;

entitymanager.packagesToScan = com.app.domain