java7 "abc".split(""); //["","a","b","c"] 이유 : abc사이에 ""가 있으므로 처음에는 ["","a","b","c",""]가 생성된다. 그러나 split메서드가 최종의 ""를 삭제하기 때문에, 최종적으로 리턴되는 형태는 ["","a","b","c"]가 된다. java8 "abc".split("") //["a","b","c"] //split String phoneNo = "010-1234-5678"; String[] arr1 = str.split("-"); arr[0]; //010 arr[1]; //1234 arr[2]; //5678 //String[] split(String regex, int limit) String phoneNo2 = "010-1234-5678"; S..
업로드 개념 mulitpart/form-data란? ajax call과 form submit의 차이점 Multipart를 클라이언트에서 보내고 서버에서 받는 방법 Client : form 태그 input type="file"의 원리 Server : Servlet-Context란? Spring : @RequestMapping이 처리하는 커맨드 객체 구현옵션 환경설정 build.gradle, web.xml, servlet-context.xml [tomcat] context.xml
@ExceptionHandler : @Controller, @Restcontroller가 적용된 하나의 api에서 발생하는 예외를 잡는다. 인자로 캐치하고 싶은 예외클래스를 등록. @ControllerAdvice : 모든 @Controller의 예외를 잡는다. @RestControllerAdvice : @ControllerAdvice + @ResponseBody, 즉 객체 리턴이 필요할 경우. [Controller] @RestController public class TestController { pulbic testResponse requestTest(@RequestBody testRequest request) throws CustomException { if ( ~ ) { logger.warn("[T..
추상화를 통해 원을 만들어보겠다. 우리가 정의한 이 '원'은 반지름을 정의할 수 있고, 면적을 알아낼 수 있다. [EX1] class Circle { //원의 추상화 double r; //반지름 public Cirlcle(double a) { r = a; } public double getArea() { //면적 return r * r * 3.14; } } main 메서드를 통해서 원에게 실제로 값을 부여(메모리를 할당)해보겠다. - new를 사용하여 원에게 5.0이라는 값을 전달하면, 메모리가 할당되며 반지름이 5.0인 '원'이 생성된다. Circle 클래스의 생성자를 통해 double a의 값이 double r로 전달된다. [EX2] public class CircleArea2 { public sta..
restTemplate 상태코드 가져오기 https://gist.github.com/ktarou/a875e84d0a65dce99dd38e307fe016e1 public class HandleHttpServerErrorException { private ObjectMapper objectMapper = new ObjectMapper(); public ResponseEntity handleRestTemplateCall() throws IOException { HttpHeaders headers = new HttpHeaders(); headers.add(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_UTF8_VALUE); headers.setContentType(Media..
카드 서버 리뉴얼 카드 서버가 vertex로 개발되어 있는데 메모리를 많이 잡아먹고 있다. 버텍스는 event driven 형식이 장점인데 event driven 형식으로 개발되어 있지 않기도 하고 메모리 릭으로 서버가 강종되는 일이 빈번하여 프레임웤을 spring boot으로 변경하여 재개발하기로 하였다. 메모리 릭이 가장 큰 문제였던만큼 tps가 안정적인지를 검토하는 과정이 필요했다. 이에 jmeter를 사용해 tps를 측정하기로 하였다. jmeter 설정값 https://kamang-it.tistory.com/399 카드 서버의 동시성 제어 spring boot의 connection pool ← 커넥션 풀의 설정에 미흡한 부분이 있어서 transactional 어노테이션이 동작하지 않는가?에 대해 ..