기록
Home
  • 분류 전체보기 (187)
    • Programming (109)
      • JAVA (15)
      • Javascript (0)
      • 데이터베이스 (8)
      • React (7)
      • 프레임워크 (1)
      • Spring (11)
      • 웹(Web) (4)
      • 운영체제 (5)
      • 서버&네트워크 (6)
      • 자료구조 (0)
      • 알고리즘 (1)
      • 형상관리 (0)
      • 에러노트 (35)
      • 개발 툴 (15)
      • TEMP. (1)
    • Project (0)
      • 트러블슈팅 (0)
    • Personal (1)
      • 리뷰 (1)
      • 업무 (0)
    • Course (0)
      • 모든 개발자를 위한 HTTP 웹 기본 지식 (1)
      • 스프링 핵심 원리 - 기본편 (51)
      • 자바 ORM 표준 JPA 프로그래밍 - 기본편 (21)
    • TEMP (0)
Home
  • 분류 전체보기 (187)
    • Programming (109)
      • JAVA (15)
      • Javascript (0)
      • 데이터베이스 (8)
      • React (7)
      • 프레임워크 (1)
      • Spring (11)
      • 웹(Web) (4)
      • 운영체제 (5)
      • 서버&네트워크 (6)
      • 자료구조 (0)
      • 알고리즘 (1)
      • 형상관리 (0)
      • 에러노트 (35)
      • 개발 툴 (15)
      • TEMP. (1)
    • Project (0)
      • 트러블슈팅 (0)
    • Personal (1)
      • 리뷰 (1)
      • 업무 (0)
    • Course (0)
      • 모든 개발자를 위한 HTTP 웹 기본 지식 (1)
      • 스프링 핵심 원리 - 기본편 (51)
      • 자바 ORM 표준 JPA 프로그래밍 - 기본편 (21)
    • TEMP (0)
블로그 내 검색

기록

  • Programming/에러노트

    [Spring Framework] DAO에서 NullPointerException 에러가 날 때

    2022. 3. 10.

    by. 개발도비

    2022.1.25 작성

     

    카카오 AccessToken으로 UserInfo받아다가 DB연동 작업을 하고 있었는데 DAO에서 계속 NullPointerException 에러가 떴다. 

    널포인트에러가 나는건 빈 생성이 안 되었다는건데 component scan경로나 각 클래스의 어노테이션을 확인해도 틀린게 없어서 한참을 삽질했음. static이 문제였다. static을 쓰지 않으면 호출이 안 되는 메소드들이 몇 개 있어서 하는 김에 그냥 다 static으로 호출해버렸더니 autowired 어노테이션이 제대로 작동을 못 한 것. 

     

    한참을 헤맸는데 static을 지워주니 정상적으로 잘 작동했다.

    static 선언한 상태에서도 빈 생성하는 방법이 없지는 않은 것 같으나

    그렇게 하면 스프링을 쓰는 의미가 없으므로 지양하는 것이 좋겠다. 

    'Programming > 에러노트' 카테고리의 다른 글

    Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias  (0) 2022.05.03
    [Windows/IntelliJ] Address localhost:1099 is already in use  (0) 2022.04.14
    [스프링프레임워크] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Use logout-success-url or success-handler-ref, but not bothOffending resource  (0) 2022.03.10
    [스프링프레임워크] org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'ROLE_ADMIN' cannot be found on object of type 'org.springframework.security.web.access.expression.WebSecurityExpressionRoot' - maybe not ..  (0) 2022.03.10
    [스프링프레임워크] org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' available  (0) 2022.03.10

    댓글

    관련글

    • Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 2022.05.03
    • [Windows/IntelliJ] Address localhost:1099 is already in use 2022.04.14
    • [스프링프레임워크] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Use logout-success-url or success-handler-ref, but not bothOffending resource 2022.03.10
    • [스프링프레임워크] org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'ROLE_ADMIN' cannot be found on object of type 'org.springframework.security.web.access.expression.WebSecurityExpressionRoot' - maybe not .. 2022.03.10
    맨 위로
전체 글 보기
Tistory 로그인
Tistory 로그아웃
로그아웃 글쓰기 관리

Today

Total

Powered by ⓒ Kakao Corp.

Designed by Nana
블로그 이미지
개발도비

티스토리툴바