목록springboot (4)
devNyong
requestParam = { startDt : 2022-10-06T08:25:50.807Z , endDt : 2022-10-06T08:25:50.807Z, } reqDto @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) private LocalDate startDt; @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) private LocalDate endDt; Mybatis AND DT BETWEEN #{startDt, jdbcType=DATE} AND #{endDt, jdbcType=DATE}+1
//getRealPath() : 실제 톰캣이 돌아가고 있는 컴퓨터에서 그 곳의 절대 주소값 String rootPath = request.getSession().getServletContext().getRealPath("/"); //저장경로 1 String uploadPath = rootPath + "upload" ; 2 String uploadPath = request.getServletContext().getRealPath("/upload");
@RestControllerAdvice : Exception 발생 시 JSON으로 반환받기 위하여 생성합니다. @ExceptionHandler: Bean에서 발생하는 에러를 잡아 처리합니다 전역의 예외를 잡긴하되 패키지 단위로 제한 할 수 도 있다. @RestControllerAdvice("com.example.demo.login.controller") @RestControllerAdvice(basePackages = "com.spring2.nyong.api") @RequiredArgsConstructor @RestControllerAdvice(basePackages = "com.spring2.nyong.api") public class ExceptionAdvice { private final Respo..
@RunWith(SpringRunner.class) // 스프링부트테스트와 junit 사이의 연결자 기능 @ActiveProfiles("local") @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class ApiControllerTest { @LocalServerPort private int port; @Autowired private TestRestTemplate restTemplate; @Autowired private Repository repository; @Test public void insert() { String url = "http://localhost:" + port + "/api/v..