Spring 28

[Baedung] Best Practices for REST API Error Handling

더보기 https://www.baeldung.com/rest-api-error-handling-best-practices 링크의 포스팅 일자 2021.5.13 REST 는 Client가 서버의 resource에 access and manipulate 하는 stateless한 아키텍쳐이다 보통 REST service들은 HTTP를 활용한다 HTTP Status Codes 클라이언트가 HTTP 서버에 request하고 요청을 성공적으로 수신하면 서버는 해당 처리 여부를 response해준다 HTTP accomplishes this with five categories of status codes: 100-level (Informational) – server acknowledges a request //서버..

[Spring] Assertions in JUnit 4 and JUnit 5

더보기 https://www.baeldung.com/junit-assertions Assertions Assertions은 테스트에서 해당 Assertion 조건을 지원해주는 메소드이다. (JUnit 4의 Assert 클래스와 JUnit 5의 Assertions 클래스를 통해 액세스) JUnit 5는 JUnit 4의 많은 어설션 메서드를 유지하면서 Java 8 지원을 활용하는 몇 가지 새로운 메서드를 추가했다. JUnit4에도 있는 JUnit 5 어설션 부터 정리한다 assertArrayEquals 예상배열과 실제 배열 동일 여부 확인 @Test public void whenAssertingArraysEquality_thenEqual() { char[] expected = { 'J', 'u', 'p', ..

Web/spring 2023.04.25

[Spring Exception]Guide to Spring NonTransientDataAccessException

https://www.baeldung.com/nontransientdataaccessexception 막바지로 달려가는 중.. 나중에 포스팅한거 정리 좀 해야겠다ㅜㅜ NonTransientDataAccessException The Base Exception Class 일시적이지 않거나 영구적인 데이터 액세스 관련 예외처리를 나타냄 이 예외가 발생되면 그 이후 해결할 때 까지 모든 시도를 실패하게 됨 Subclasses of this main exception class represent data access related exceptions which are considered non-transient or permanent. Simply put, that means that – until the roo..

Web/spring 2023.04.10

[Spring Exception] Spring NoSuchBeanDefinitionException

https://www.baeldung.com/spring-nosuchbeandefinitionexception + 예외처리 리스트 https://www.baeldung.com/spring-exceptions Spring org.springframework.beans.factory.NoSuchBeanDefinitionException. Spring Context에 정의되지 않은 bean을 해결하려고 시도할 때 BeanFactory 에 의해 발생하는 일반적인 예외들이다 Cause: No Qualifying Bean of Type […] Found for Dependency 단순히 정의되지 않은 빈을 주입하려고 시도하는 경우 예시코드 @Component public class BeanA { @Autowired..

Web/spring 2023.04.09

[Spring Exception] Spring DataIntegrityViolationException

https://www.baeldung.com/spring-dataIntegrityviolationexception Spring org.springframework.dao.DataIntegrityViolationException DataIntegrityViolationException and Spring Exception Translation Spring 예외 변환 메커니즘은 컨텍스트에서 예외 변환 빈 포스트 프로세서 빈을 정의하여 @Repository 로 주석이 달린 모든 빈에 적용할 수 있다. @Configuration public class PersistenceHibernateConfig{ @Bean public PersistenceExceptionTranslationPostProcessor exce..

Web/spring 2023.04.08

[Spring] Async Support with Spring MVC and Spring Security

https://www.baeldung.com/spring-mvc-async-security 비동기 요청에 대한 Servlet 3 과 MVC, Security 에 관련된 내용이다 참고로 Spring Security는 MVC 범위 밖에서 @Async 와 통합되고 HTTP 요청도 처리합니다. implementation 'org.springframework.boot:spring-boot-starter-security' testImplementation 'org.springframework.security:spring-security-test' Spring MVC and @Async WebAsyncManager https://docs.spring.io/spring-framework/docs/current/java..

Web/spring 2023.04.06

[Spring] A Guide To Spring Redirects

https://www.baeldung.com/spring-redirect-and-forward implementing a Redirect in Spring and will discuss the reasoning behind each strategy. Why Do a Redirect? Spring 애플리케이션에러 리디렉션을 수행해야하는 이유는 많다 양식 데이터를 POST하거나 이중 제출 문제를 해결하거나, 실행 흐름을 다른 Controller Method에 위임하는 경우 등이 있다 ** 일반적으로 Post, Redirect, Get 패턴은 이중 제출 문제를 적절하게 해결하지 못하므로 초기 제출 완료 전에 페이지를 새로 고치는 것과 같은 문제는 여전히 이중 제출로 이어진다. Redirect With the ..

Web/spring 2023.04.06

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