Web 242

[Spring] Spring MVC Custom Validation

https://www.baeldung.com/spring-mvc-custom-validator https://www.baeldung.com/spring-boot-bean-validation 8자리 이상 11자리 이하의 전화번호 값이 제대로 들어왔는지 확인하는 Validation 을 만들어본다 The New Annotation new @interface to define our annotation @Documented @Constraint(validatedBy = ContactNumberValidator.class) @Target( { ElementType.METHOD, ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) public @interface C..

Web/spring 2023.04.05

[Spring Security] Handle Spring Security Exceptions

https://www.baeldung.com/spring-security-exceptions Spring Security는 비즈니스 로직에 대한 호출을 제어하거나 특정 URL에 대한 HTTP 요청 액세스를 제한한다 해당 보안 계층에서 Exceptions 처리가 어떻게 진행되는지 알아보자 Authentication Success Handler Authentication Failure Handler Access Denied Handler Security Configuration This will be in charge of managing all the security configurations of the application SecurityFilterChain @Bean public SecurityFil..

Web/spring 2023.04.04

[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

[JPA] 강의 들으면서 쫌쫌따리

더보기 https://youtu.be/1Q3Qtd5HZy4?list=PLwouWTPuIjUgRvSmAVlZekcyAo4zkf_TK Spring Boot + Spring Data JPA 자동설정 persistence.xml, EntityManagerFactory 스프링연동 스프링 트랜잭션 연동 EntityManager 연동 spring-boot-starter-data-jpa Repository interface를 엔티티 단위로 생성 필요한 곳에 주입해서 사용하면 된다 datasource, database 등에 대한 설정값 입력 스프링 부트에 따라 설정이 달라지니 문서를 보고 설정해주어야한다.

Web/tip 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
728x90