데이터 바인딩 추상화 - propertyEditor 데이터 바인딩 org.springframework.validation.DataBinder java.beans.PropertyEditor https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/validation/DataBinder.html WEB MVC에만 특화된 것이 아니라 여러 곳에서 쓰이는 스프링 핵심 기술 기술적인 관점 프로퍼티 값을 타겟 객체에 설정하는 기능 사용자 관점 사용자 입력값을 애플리케이션 도메인 모델에 동적으로 변환해 넣어주는 기능. 입력값은 대부분 "문자열"인데, 그 값을 객체가 가지고 있는 int, long, Boolean, Date 등 심지어 Event, Book 같은 도메인 타입으로도 변환해서 넣어주는 기능. PropertyEditor public class EventEditor extends PropertyEditorSupport{ @Override public String getAsText() { Event event = (Event)getValue(); return event.getId().toString(); } @Override public void setAsText(String text) throws IllegalArgumentException { setValue(new Event(Integer.parseInt(text))); } } 스프링 3.0 이전까지 DataBinder 가 변환 작업 사용하던 인터페이스 getValue 는 PropertyEditorSupport 가 받은 객체를 가져올 수 있다. getValue와 setValue는 객체를 공유 하고 있으며 PropertyEditor가 가지고 있는 값 이다. 서로 다른 쓰레드에 공유 를 한다.( 쓰레드-세이프 하지 않음 ) Bean 으로 등록해서 쓰지 말아야 한다. Ob...
AOP 설정방법 - @annotation 1. Controller에서 @anntation 붙이기 Controller 2. @annotation interface 만들기 public @interface ParameterCheck { } 3. @annotation 구현체 만들기 @Aspect @Component public class ParameterCheckAspect { @Pointcut("@annotation(com.test.test1.api.aop.aspect.ParameterCheck)") public void parameterCheck() { } @Before("parameterCheck()") public void checkParameter() throws Throwable { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()) .getRequest(); HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()) .getResponse(); System.out.println("=== AOP TEST ==="); } } 4. aop xml에 설정 붙이기 5. pom.xml 추가 org.springframework spring-aspects ${org.springframework-version} spring AOP설정은 여러가지 방법이 있는데 @annocation을 이용하여 설정하는게 직관적이라 보기 좋은거 같다... from http://rlawls1991.tistory.com/54 by ccl(A) rewrite - 2020-03-25 10:20:24
[샤니마스 SPRING PARTY2020] THE IDOLM @ STER SHINY COLORS SPRING... 상품판매 : https://idolmaster.jp/blog/?p=80506 프로듀서 여러분, 안녕하세요. 평소 아 소비 스토어를 이용해 주셔서 감사합니다. 「THE IDOLM @ STER SHINY COLORS SPRING PARTY 2020」의 회장에서 판매를 예정하고 있던 상품의 판매를 오늘부터 시작했습니다. 자세한 내용은 여기를 확인하시기 바랍니다. https://shop.asobistore.jp/feature/scspringpary2020_p/ 대상 상품은 아 소비 스토어에서 판매 페이지 내에서「 「THE IDOLM @ STER SHINY COLORS SPRING PARTY 2020」의 회장에서 판매를 예정하고 있던 상품입니다.」라고 설명하고 있습니다. 아 소비 스토어 URL : https://shop.asobistore.jp/ from http://ascarot-765.tistory.com/2511 by ccl(A) rewrite - 2020-03-25 21:54:26
댓글
댓글 쓰기