'2021/11/30'에 해당되는 글 2건

  1. 2021.11.30 [Spring] bean name conflict resolve.
  2. 2021.11.30 [Spring] @Autowired vs @RequiredArgsConstructor

[Spring] bean name conflict resolve.

ITWeb/개발일반 2021. 11. 30. 12:17

간단하게는 명시적으로 선언을 해주시면 됩니다.

 

서로 다른 패키지에 같은 이름의 class 가 존재 할 경우 발생 할 수 있습니다.

이런 경우 아래와 같이 선언해 주시면 됩니다.

 

@RestController("cat.RestHealthController")

@Service("cat.service.HealthService")

 

@RestController("cluster.RestHealthController")

@Service("cluster.service.HealthService")

 

:

[Spring] @Autowired vs @RequiredArgsConstructor

ITWeb/개발일반 2021. 11. 30. 10:36

Spring DI 선언에 사용 합니다.

 

[Spring Autowired Annotation]

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/annotation/Autowired.html

 

[Lombok RequiredArgsConstructor Annotation]

https://projectlombok.org/api/lombok/RequiredArgsConstructor.html

 

: