immutability1 [Spring] Constructor Injection 방식을 권장하는 이유 요즘 아무 생각 없이 의존성 주입을 @Autowired를 사용한 필드 주입 방식으로 작성하다보니, 인텔리제이에서 경고메시지를 보여줬다. Field injection is not recommended .. Always use constructor based dependency injection in your beans 또한 백기선님의 스프링 부트 강의를 듣고있었는데 단일 생성자이며, 그 생성자의 파라미터가 빈일경우 스프링이 생성자를 자동으로 주입해준다고하였다. @Autowired를 사용하지 않아도 된다. public class Member { private final ProductService productService; public Member(ProductService productService) { .. 2019. 12. 25. 이전 1 다음