1_[spring]여러가지 어노테이션
여러 가지 Annotation
🌟기본적으로 response는 Object Mapper를 통해서 json 형태로 변경되어 내려지게 됨
⭐ @Configuration 상기하기!
@Configuration
class AppConfig{
@Bean("base64Encode")
public Encoder encoder(Base64Encoder base64Encoder){
return new Encoder(base64Encoder);
}
@Bean("urlEncode")
public Encoder encoder(UrlEncoder urlEncoder){
return new Encoder(urlEncoder);
}
}
🌟@Qualifier 상기하기
package com.ioc_di.ioc_di.encoder;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
@Component
public class Encoder {
private IEncoder iEncoder;
public Encoder(@Qualifier("urlEncoder") IEncoder iEncoder){
this.iEncoder=iEncoder;
}
public void setEncoder(IEncoder iEncoder){
this.iEncoder=iEncoder;
}
public String encode(String msg){
return iEncoder.encode(msg);
}
}