전체 글 336

[Annotation] Spring Bean Annotations

https://www.baeldung.com/spring-bean-annotations 애노테이션 시리즈 마지막~~!! Spring 컨테이너에서 빈을 구성하는 방법 1. XML 구성을 사용하여 선언 2. 구성 클래스에서 @Bean 애노테이션 사용 3. org.springframework.stereotype 패키지 의 주석 중 하나로 클래스를 표시 (leave the rest to component scanning) Component Scanning Spring은 Component Scanning이 활성화된 경우 bean에 대한 패키지를 자동스캔할 수 있다 @ComponentScan은 어노테이션 구성으로 클래스를 검색할 패키지를 구성한다 // basePackages 또는 값 인수 중 하나를 사용하여 기본 ..

Web/spring 2023.04.01

[Spring MVC] @Controller 와 @RestController 차이

https://www.baeldung.com/spring-controller-vs-restcontroller Spring 4.0은 RESTful 웹 서비스 생성을 단순화하기 위해 @RestController 주석을 도입했다. @Controller 와 @ResponseBody를 결합한 편리한 주석으로 컨트롤러 클래스의 모든 요청 처리 메서드에 @ResponseBody 주석을 달 필요가 없다. Spring MVC @Controller simply a specialization of the @Component class, which allows us to auto-detect implementation classes through the classpath scanning. typically use @Contr..

Web/spring 2023.04.01

[Annotation] Spring Scheduling Annotations

https://www.baeldung.com/spring-scheduling-annotations org.springframework.scheduling.annotation 단일 thread 보다 더 복잡한 실행이 필요할 경우에 사용함 @EnableAsync 이 애노테이션은 Spring에서 비동기 기능을 활성화 한다 @Configuration 과 함께 사용해야 한다 *** @Configuration @EnableAsync class VehicleFactoryConfig {} 이렇게 비동기 호출을 활성화 시킨 후 원하는 메서드에 @Async 를 붙여서 정의하면 된다 @EnableScheduling 이 애노테이션을 사용하여 스케쥴링을 활성화 한다 @Configuration 과 함께 사용해야 한다 *** @C..

Web/spring 2023.03.31

[Spring] 요청에 따른 부가응답 추가하기

https://meetup.nhncloud.com/posts/148 Spring에서 요청에 따른 부가 응답 추가하기 (1) : NHN Cloud Meetup Spring에서 요청에 따른 부가 응답 추가하기 (1) meetup.nhncloud.com 해당 출처를 이용하여 코드 작성했습니다. 해당 블로그에서 MicroService 를 베이스로 사용한 부가 처리 작업 예시가 있어서 읽어보았다. OOP 의 특성을 최대한 살려서 코드를 작성했다고 하는데, 정리하자면 Interceptor를 이용하여 부가작업을 처리해주는 코드였다 테스트 코드도 있어서 공부하기에 적합할 것 같아 위의 링크 내용을 참조하여 나에게 맞게 코드를 작성해봤다 기본 API 에 기능을 추가한 것으로 구현 방법은 아래와 같다. 기본 API에 at..

Web/spring 2023.03.29

[Spring Interceptor] Introduction to Spring MVC HandlerInterceptor

https://www.baeldung.com/spring-mvc-handlerinterceptor * spring-web 종속 Spring MVC Handler HandlerMapping은 handler method를 URL에 매핑한다 DispatcherServlet request 처리 시 호출할 수 있다 the DispatcherServlet uses the HandlerAdapter to actually invoke the method. Spring Handler Interceptor a Spring interceptor is a class that either extends the HandlerInterceptorAdapter class or implements the HandlerIntercept..

Web/spring 2023.03.29
728x90