SpringBoot Bean 등록

이기현·2020년 12월 21일

Spring Boot

목록 보기
7/12

java class를 만들고 @Autowired한다고 해서 해당 Class를 객체로 사용할 수 없다.
스프링에서 객체로 사용하기 위해서는 Spring Container에 등록되어야 사용할 수 있다.
자바 class를만들고 해당 목적에 따라서 @Repository, @Bean, @Component, @Service등의 Annotation을 통해서 Spring Container안에 Bean으로 등록해주고 다른 곳에서 @Autowired로 등록 후 사용하면 된다.

profile
실력을 쌓아가는 하루하루

0개의 댓글