Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'trajectoryRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'trajectoryRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class

Spring Boot tries to guess the location of your @Entity definitions, based on the @EnableAutoConfiguration it finds. To get more control, you can use the @EntityScan annotation.

I used the @EntityScan annotation in the Spring main class to resolve this issue


The @ComponentScan annotation is used to automatically create beans for every class annotated with @Component@Service@Controller@RestController@Repository, ... and adds them to the Spring container (allowing them to be @Autowired).
The @EntityScan on the other hand does not create beans as far as I know. It only identifies which classes should be used by a specific persistence context.

1 comment:

Algorithms said...

Your post was useful.

Thank you.

 Python Basics How to check the version of Python interpreter mac terminal

Popular in last 30 days