No qualifying bean of type [javax.persistence.EntityManager]

The EntityManager interface belongs to JPA and is implemented by JPA providers (such as Eclipse), not Spring, and it has its own injection annotation: @PersistenceContext. EntityManager objects are transaction-scoped and should not be exposed as beans as you’re doing. Instead, either use the JPA annotation to inject the EntityManager:

@PersistenceContext
EntityManager em;

or, since it looks like you’re trying to use Spring repositories, inject the repository instead:

@Autowired
PersonRepository pr;

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)