슬픈강낭콩

Parameter 0 of constructor in com.exam.mix.controller.HelloWorldController required a bean of type 'com.exam.mix.service.AllCoreService' that could not be found. 오류 본문

개인프로젝트/mix

Parameter 0 of constructor in com.exam.mix.controller.HelloWorldController required a bean of type 'com.exam.mix.service.AllCoreService' that could not be found. 오류

슬픈강낭콩 2023. 1. 19. 22:54

Parameter 0 of constructor in com.exam.mix.controller.HelloWorldController required a bean of type 'com.exam.mix.service.AllCoreService' that could not be found. 

 

거의 다 만들었는데 오류가 발생했다. 빈을 등록하라는데 다 했는데 오류가 나서 신기하다

 

해결법 : Serviceimpl 에 @Service를 적었더니 잘 된다. impl에는 어노테이션을 안적어줬는데 인터페이스랑 둘다 만들어야 하나보다.

 

그런데 또 오류가 생겼다.

 

 Error creating bean with name 'helloWorldController' defined in file [C:\Users\aaaa\Desktop\mixmaster-master\out\production\classes\com\exam\mix\controller\HelloWorldController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'allCoreServiceimpl' defined in file [C:\Users\aaaa\Desktop\mixmaster-master\out\production\classes\com\exam\mix\service\AllCoreServiceimpl.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gubunCoreRepository' defined in com.exam.mix.repository.GubunCoreRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class com.exam.mix.DTO.AllListCore

 

 

구글로 번역해보니 이랬다.

 

파일에 정의된 이름이 'helloWorldController'인 빈을 생성하는 동안 오류가 발생했습니다. [C:\Users\aaaa\Desktop\mixmaster-master\out\production\classes\com\exam\mix\controller\HelloWorldController.class]: 생성자 매개 변수 0을 통해 표현된 불만족 종속성. 중첩 예외는 org.springframework입니다.콩 공장.불만족 종속성 예외: 파일에 정의된 이름이 'allCoreServiceimpl'인 빈을 생성하는 동안 오류가 발생했습니다.

[C:\Users\aaaa\Desktop\mixmaster-master\out\production\classes\com\exam\mix\service\AllCoreServiceimpl.class]: 생성자 매개변수 1을 통해 표현된 불만족스러운 종속성. 중첩 예외는 org.springframework입니다.

콩 공장.콩 만들기예외: com.exam.mix.repository에 정의된 이름이 'gubunCoreRepository'인 bean을 만드는 동안 오류가 발생했습니다.

JpaReposities Registrar에 선언된 @EnableJpaReposities에 정의된 GubunCoreRepository입니다.Jpa 리포지토리 구성 사용: init 메서드를 호출하지 못했습니다.

중첩된 예외는 java.lang입니다.잘못된 인수예외: 관리되는 유형이 아닙니다. class com.exam.mix.DTO.AllListCore

 

 

해결했다. ?...

 

원래는 아래처럼 만들어서 스위치로 8개 종족에 리포지토리를 8개 만드는게 많을것 같아서 그냥 다향성이용해서 AllListCore에 8종족을 상속 받아서 리포지토리를 하나만 사용하려했는데 그게 문제였나보다. 컴파일에는 문제가 없었어서 8개정도 만들어보고 나중에 해결해야 할 것 같다... 기분은 좋다 1시간정 도 걸린것같은데 굳굳~

public interface AllListCoreRepository extends JpaRepository<AllListCore, Integer> {
}