[Error] Field repository in required a bean of type 'xxx' that could not be found.

2023. 5. 11. 01:24·Error

# Error

Intellij에서 @Autowired를 통해서 CrudRpository를 상속받는 인터페이스를 사용할 때 아래와 같은 error가 발생한다.

Field repository in com.example.SpringDataJDBCSample.SpringDataJdbcSampleApplication required a bean of type 'xxx' that could not be found. 

 

# Solution

@EnableJdbcRespositories을 통해 JDBC Repository 를 활성화 할 수 있다.

@SpringBootApplication
@EnableJdbcRepositories(basePackages = { "path of target package ex) com.demo" })
public class SpringDataJdbcSampleApplication {
	public static void main(String[] args) {
		...
	}

	@Autowired
	Sample repository;
}

# Reference

https://docs.spring.io/spring-data/jdbc/docs/current/api/org/springframework/data/jdbc/repository/config/EnableJdbcRepositories.html

 

EnableJdbcRepositories (Spring Data Relational Parent 3.0.5 API)

repositoryImplementationPostfix String repositoryImplementationPostfix Returns the postfix to be used when looking up custom repository implementations. Defaults to Impl. So for a repository named PersonRepository the corresponding implementation class wi

docs.spring.io

 

'Error' 카테고리의 다른 글

[Error] Could not autowire. No beans of 'xxxx' type found.  (0) 2023.05.10
'Error' 카테고리의 다른 글
  • [Error] Could not autowire. No beans of 'xxxx' type found.
Log Cat
Log Cat
잊어버리지 않기 위한 메모장
  • Log Cat
    개발 메모장
    Log Cat
  • 전체
    오늘
    어제
    • 전체보기 (45) N
      • Book Review (6)
      • Language (15) N
        • Java (10) N
        • Go (1)
        • JavaScript (1)
        • TypeScript (3)
      • Computer Science (3)
        • Network (1)
        • Database (1)
        • Design Pattern (0)
      • Spring Framework (10)
        • Spring & Spring Boot (4)
        • Spring Batch (4)
        • Servlet & JSP (2)
      • Python Framework (3)
        • FastAPI (3)
      • Infra (3)
        • Dcoker (1)
        • Kafka (2)
      • ORM (1)
        • JPA (1)
      • Fun (1) N
      • Error (2)
      • Retrospective (0)
      • Certificate (1)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

    • Github
  • 인기 글

  • 태그

    jmm
    이팩티브 자바
    네트워크 원리
    escape-analysis
    프로그래머스문제
    spring boot
    Java
    leetcode
    개발서적리뷰
    프로그래머스 문제
    자바 풀이
    spring kafka
    effective java 3/e
    프로그래머스
    우아한테크코스
    BOJ
    Python
    fastapi
    jvm
    개발서적
    코테
    코딩테스트
    리트코드
    성공과 실패를 결정하는 1%의 네트워크 원리
    Typescript
    자바
    programmers
    네트워크
    백준
    spring
  • 최근 글

  • hELLO· Designed By정상우.v4.10.6
Log Cat
[Error] Field repository in required a bean of type 'xxx' that could not be found.
상단으로

티스토리툴바