Below is the trace :
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'testController': Unsatisfied dependency expressed through field 'testDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testDAO': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class modele.Test
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testDAO': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class modele.Test
...
Caused by: java.lang.IllegalArgumentException: Not a managed type: class modele.Test
From my understanding the root error is Not a managed type: class modele.Test
, which would have something to do with Test not being recognized as an entity ?
Here's my project :
Architecture : https://i.stack.imgur.com/xcYVi.jpg
Application.java
@SpringBootApplication
@ComponentScan("boot")
@ComponentScan("dao")
@ComponentScan("modele")
@EnableJpaRepositories("dao")
public class Application {
public static void main (String[] args){
SpringApplication.run(Application.class, args);
}
}
TestDAO.java
@Transactional
public interface TestDAO extends CrudRepository<Test, Long > {
/**
* This method will find an User instance in the database by its email.
* Note that this method is not implemented and its working code will be
* automagically generated from its signature by Spring Data JPA.
*/
public Test findByEmail(String email);
}
Test.java
@Entity
@Table(name = "test")
public class Test {
// An autogenerated id (unique for each user in the db)
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@NotNull
private String email;
@NotNull
private String name;
// Public methods
public Test() {
}
public Test(long id) {
this.id = id;
}
public Test(String email, String name) {
this.email = email;
this.name = name;
}
//setters and getters
I'd appreciate any help. Thanks!