코딩박스

[Error] intellij Autowired injection 에러

by 코박7

에러발생.

Could not autowire. No beans of UserService' type found.
  • @Autowired 어노테이션을 이용해 injection 주입을 진행 중 에러 발생.
  • 서버 실행이 안되는 상황이라 무조건 잡고 넘어가야하는 상황
  • 리서치 진행했으나 setting 을 바꿔주는건 효과 없었음.

 

해결

1. intellij 재시작 [실패]

  • 가장 간단하면서 가장 중요한 방법.
  • 재시작으로 해결됐으면 하는 바람에 시도해봤으나 실패

 

2. Help - custom properties 사용 [실패]

- 몇몇 블로그 및 스택오버플로우에선 Help ⇒ Edit Custom Properties 에서 옵션을 추가해주면 된다고했다.

idea.spring.boot.filter.autoconfig=false
  • 옵션을 추가해줬으나 실패

 

3. setting 옵션 변경 [실패]

  • file ⇒ setting ⇒ Editor ⇒ inspections ⇒ spring core ⇒ code ⇒ Autowiring issues in a Spring bean… 옵션 끄기
  • 위 옵션을 끄면 된다는 글을 발견해서 시도해봤지만 역시 실패

 

4. Project Structure 옵션 변경 [성공]

 

 

참고: https://itecnote.com/tecnote/spring-boot-intellij-idea-could-not-autowire-no-beans-of-type-found/

 

Spring-boot – IntelliJ Idea + Could not autowire. No beans of type found – iTecNote

I keep seeing below error in my IntelliJ Idea, however the code works fine during execution. Could not autowire. No beans of 'PortfolioRequestHandler' type found. less... (Ctrl+F1) Inspection info:Checks autowiring problems in a bean class. Sample Code @Ac

itecnote.com

 

 

위 블로그를 발견했는데 Project Structure 옵션에서 Modules → Depedencies → + 버튼 클릭 → JARs or Directories… 옵션 클릭 → ok 버튼 클릭으로 문제 해결

 

블로그의 정보

코딩박스

코박7

활동하기