Web/spring 113

[Task Execution and Scheduling] @Scheduled annotation

@Scheduled 애노테이션을 이용하면 아주 쉽게 메소드 추가가 가능하다 @EnableScheduling // 스케줄링 @SpringBootApplication public class AnythingTestApplication { ... } 다음 메서드는 고정된 지연 시간을 두고 5초(5000밀리초)마다 호출됩니다. 즉, 기간은 각 이전 호출의 완료 시간부터 측정된다. @Scheduled(fixedDelay = 5000) public void doSomething() { // something that should run periodically } https://velog.io/@kenux/Spring-Boot-Scheduled-%EC%9D%B4%EC%9A%A9%ED%95%9C-%EA%B0%84%EB%..

Web/spring 2023.11.22

JPA 프레임워크의 개념과 구조

JPA 프레임 워크 Tier (티어) - client - presentatinon - business - peristent : Mybatis, JPA - legacy JPA = java persistence api 자바 영속성 API 이전엔 Hibernate 가 있었으나 자바에서 표준으로 받아들여서 내장화한게 JPA이다 Mybatis 는 xml로 빼서 쿼리를 요청하기 때문에 : SQL Mapping 프레임워크라고 본다 => @Mapper 처리해줌 JPA는 코드를 자동으로 만들어준다. JPA 는 interface 로 작성하면 되며, 내장된 함수에서는 @Repository 로 구현클래스가 구현되어있다.

Web/spring 2023.11.12

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