일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
- Linux
- redis + spring boot 함께
- 엔티티 코드 치환
- 리눅스
- select
- docker 컨테이너로 띄우기
- 초단위
- 자바스크립트
- js
- sftp
- for문
- 만들면서 배우는 클린 아키텍처
- Java
- insert
- catalina.out
- Docker Compose
- Entity Code 치환
- 자바
- architecture
- aws elasticache 활용
- mysql
- springboot+redis
- feignClient
- 특수문자 치환
- jQuery
- 톰캣
- javascript
- 정규식
- 제이쿼리
- Tomcat
- Today
- Total
목록Java (27)
꾸준하게, 차근차근

1. *.xlsx 파일 Logger log = Logger.getLogger(this.getClass()); @Autowired private insertDAO insertMapper; public int readExcelFile(MultipartFile file, String siteCode) { File destFile = null; int resultCode = -1; try { String resUploadPath = configService.getConfigValue("PATH"); // 임시 디렉토리 경로 String yearDir = DateUtil.toString(new Date(), "yyyy"); // 연 별 디렉토리 생성 String monthDir = DateUtil.toString..

1. copyOfRange() Arrays.copyOfRange(arr, i, j) arr 배열을 i부터 j까지 자르려면 위와 같은 방법을 사용할 수 있다. public class Code { public static void main(String[] args) { int[] array = {1, 5, 2, 6, 3, 7, 4}; int[][] commands ={{2, 5, 3} ,{4, 4, 1} ,{1, 7, 3}}; System.out.println(Arrays.toString(solution(array, commands))); System.out.println(Arrays.toString(solution1(array, commands))); System.out.println(Arrays.toSt..

1. Collections.sort() import java.util.ArrayList; import java.util.Collections; public class Test { public static void main(String[] args) { ArrayList list = new ArrayList(); list.add("A"); list.add("B"); list.add("C"); list.add("a"); list.add("b"); list.add("c"); // 오름차순 Collections.sort(list); System.out.println("오름차순 : " + list); // 내림차순 Collections.sort(list, Collections.reverseOrder()); Sys..

1. For문 public class Test { public static void main(String[] args) { int[] arr = {1,2,3,4,5,6,7,8,9}; int sum = 0; for( int i=0; i a+b); System.out.println(sum); } } 3. reduce() public class Test { public static void main(String[] args) { int[] arr = {1,2,3,4,5,6,7,8,9}; int sum = Arrays.stream(arr).reduce(0, (a,b) -> a+b); System.out.println(sum); } } 4. sum() public class Test { public static ..

1. new JSONObject(hashmap) import java.util.HashMap; import java.util.Map; import org.json.simple.JSONObject; public class Test { public static void main(String[] args) { Map map = new HashMap(); map.put("key1", "value1"); map.put("key2", "value2"); JSONObject jsonObj = new JSONObject(map); } } 2. Jackson 라이브러리 import java.util.HashMap; import java.util.Map; import com.fasterxml.jackson.core.Jso..

1. maven dependency 설정 com.fasterxml.jackson.core jackson-core 2.3.0 com.fasterxml.jackson.core jackson-databind 2.3.0 2. JsonString To Map import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; public static void main(String[] args) { String dataStr = (String) jsonObj.get("data"); HashMap dataMap = new ObjectMapper() .readValue(dataStr, new Typ..

1. getOrDefault 찾는 키가 존재한다면 찾는 키의 값을 반환하고 존재하지 않는다면 기본값을 반환하는 메소드 2. 사용 방법 getOrDefault(Object key, V DefaultValue) 매개변수 : 두개의 매개변수를 허용한다. key : 값을 가져와야 하는 요소의 키 defaultValue : 지정된 키로 매핑된 값이 없는 경우 반환되어야 하는 기본값 반환값 : 찾는 key가 존재하면 해당 key에 매핑되어 있는 값을 반환하고 그렇지 않으면 기본값이 반환된다. 3. 사용 예제 /** * 완주하지 못한 선수 */ public class Code { public static void main(String[] args) { String[] participant1 = {"leo", "kik..

1. application/json과 application/x-www-form-urlencoded application/json은 {key: value}의 형태로 전송되지만 application/x-www-form-urlencoded는 key=value&key=value의 형태로 전달된다. 즉 application/x-www-form-urlencoded는 보내는 데이터를 URL인코딩 이라고 부르는 방식으로 인코딩 후에 웹서버로 보내는 방식을 의미한다. public JSONObject httpPost(String url, HashMap param) { JSONObject jsonObj = null; try { // TLS/SSL 통신 무시 TrustManager[] trustAllcerts = new Tr..