Web/spring 113

[Spring] HandlerAdapters in Spring MVC

https://www.baeldung.com/spring-mvc-handler-adapters on the various handler adapters implementations available in the Spring framework. HandlerAdapter는 Spring MVC에 유연한 방식으로 HTTP 요청 처리를 용이하게 할 수 있는 interface이다 메소드를 특정 URL에 매핑하는 HandlerMapping과 함께 사용한다 DispatcherServlet은 HandlerAdapter를 사용하여 이 메소드를 호출한다. Servlet이 메소드를 직접 호출하는게 아니다. 기본적으로 자신과 핸들러 객체 사이의 bridge 역할로 느슨한 결합(loosely coupling) 설계이다. pub..

Web/spring 2023.04.04

[Spring Test] JUnit 5 Conditional Test Execution with Annotations

https://www.baeldung.com/junit-5-conditional-test-execution 조건부 테스트 적용 방법 Operating System Conditions 경우에 따라 OS(운영체제)에 따른 테스트 시나리오를 변경해야할 경우가 있다 @EnabledOnOs 애노테이션을 붙이고 값을 제공하면 된다. 배열 인수도 가능하다. @Test @EnabledOnOs({OS.WINDOWS, OS.MAC}) public void shouldRunBothWindowsAndMac() { //... } @DisabledOnOs는 이름에서 알 수 있듯이 OS 유형 인수에 따라 테스트를 비활성화한다. @Test @DisabledOnOs(OS.LINUX) public void shouldNotRunAtLi..

Web/spring 2023.04.03

[Spring Test] Guide to JUnit 5 Parameterized Tests

https://www.baeldung.com/parameterized-tests-junit-5 Guide to JUnit 5 Parameterized Tests | Baeldung Learn how to simplify test coverage in JUnit 5 with parameterized tests www.baeldung.com JUnit5 는 여러 유용한 기능으로 테스트를 쉽게 할 수 있게 한다 특히 Parameterized 된 테스트를 이용하면, 다른 매개변수를 사용하여 단일 테스트를 여러번 실행할 수 있어 유용하다 https://junit.org/junit5/docs/current/user-guide/#running-tests-ide-eclipse JUnit 5 User Guide Alth..

Web/spring 2023.04.03

[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
728x90