skip to Main Content

Annotation-specified bean name ‘personDAO’ for bean class [com.gmail.tihamer.rozman.demo.PersonDAO] conflicts with existing, non-compatible bean definition of same name and class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]

I am trying to recreate the tutorial from here

https://spring.io/guides/gs/accessing-data-mysql

I created the interface and the pojo. Didnt see where is it twice

package com.gmail.tihamer.rozman.demo;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Entity
public class Person {
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
  private int id;
  private String name;
}

the interface

package com.gmail.tihamer.rozman.demo;

import org.springframework.data.repository.CrudRepository;


// This will be AUTO IMPLEMENTED by Spring into a Bean called userRepository
// CRUD refers Create, Read, Update, Delete

public interface PersonDAO extends CrudRepository<Person, Integer> {

}

2

Answers


  1. Need more information. Post your code!

    Login or Signup to reply.
  2. I’m not sure why you want to name a repository a DAO. It’s good practice to name that class PersonRepository.

    In any case, you can check this post to debug your problem. Annotation-specified bean name conflicts with existing, non-compatible bean def

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search