◽ Spring, SpringBoot
2019. 10. 3.
09:50
[Spring - 어노테이션(Annotation) ] @AliasFor
오버라이드, 즉 별명을 지어주는 기능을 한다라고 보면된다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
@Data
@Alias("city")
public class City {
private Long id;
private String name;
private String country;
private Long population;
public City() {
}
public City(String name, String country, Long population) {
this.name = name;
this.country = country;
this.population = population;
}
}
|
@Alias 어노테이션은 xml에서 아래와 같이 resultType 별칭으로 사용할 수 있다. 사용하지 않아도 무방하다.
대신 resultType에 classpath 경로를 적어줘야한다. 예) com.ssw.City