전체 글
-
JSON 이스케이프 처리tools 2022. 5. 31. 18:48
JSON 이스케이프 문자 변환해주는 사이트 https://www.freeformatter.com/json-escape.html#ad-output Free Online JSON Escape / Unescape Tool - FreeFormatter.com JSON String Escape / Unescape Escapes or unescapes a JSON string removing traces of offending characters that could prevent parsing. The following characters are reserved in JSON and must be properly escaped to be used in strings: Backspace is replaced wit ..
-
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: Error attempting to apply AttributeConverter; nested exception is javax.persistence.PersistenceExceptionSpring 2022. 5. 31. 18:45
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: Error attempting to apply AttributeConverter; nested exception is javax.persistence.PersistenceException:.. JPA AttributeConverter에서 exception 발생하는 경우입니다. JPA entity에서 conveter를 만들어서 사용하는 경우에 null 처리가 안되어 있을 때 발생합니다. public class ExampleEntity { // ...
-
Java - 싱글턴(Singleton) 패턴Java 2022. 5. 30. 20:26
싱글턴 패턴이란? 애플리케이션이 시작될 때 어떤 클래스가 최초 한번만 메모리를 할당하고(static) 그 메모리에 인스턴스를 만들어 사용하는 디자인 패턴 생성자가 여러 차례 호출되더라도 실제로 생성되는 객체는 하나고 최초 생성 이후에 호출된 생성자는 최초에 생성한 객체를 반환 다른 클래스 인스턴스들과 데이터 공유가 쉬움 Database Connection Pool처럼 공통된 객체를 여러개 생성해서 사용해야하는 상황에서 많이 사용(쓰레드풀, 캐시, 로그 기록 객체등) anti-pattern이므로 가급적 사용하지 않는 것이 좋음 싱글턴 패턴의 문제점 너무 많은 일을 하거나 많은 데이터를 공유시킬 경우 다른 클래스 인스턴스들 간의 결합도가 높아져 "개방-폐쇄 원칙"을 위배하게 된다. 수정, 테스트가 어려움 싱..
-
Java - 자바 절대값, 랜덤 함수Java 2022. 5. 30. 19:42
안녕하세요. 오늘은 자바의 Math 클래스를 이용하여 절대값과 랜덤값 생성하는 방법을 알아보겠습니다. java.lang.Math 클래스는 수학에서 자주 쓰이는 함수들을 구현해 놓은 클래스입니다. 절대값(abs) 구하기 Math.abs()를 이용해서 절대값을 구할 수 있습니다. import java.lang.Math; class HelloWorld { public static void main(String[] args) { System.out.println(Math.abs(10)); // 10 System.out.println(Math.abs(-10)); // 10 System.out.println(Math.abs(-1.2); // 1.2 } } 랜덤값 구하기 Math.random()을 이용해서 랜덤값을 ..
-
JavaScript - Arrays 다루기JavaScript 2022. 5. 30. 19:26
1. Array.map() map()을 이용해서 array를 다른 형태로 바꿀 수 있다. const data = [{ name:'lebron', age: 38 }, { name:'curry', age: 34 }, { name:'durant', age: 34 }, { name:'harden', age: 34 }, { name:'embiid', age: 25 }] const mappedData = data.map(element => element.name); console.log(mappedData) // [ 'lebron', 'curry', 'durant', 'harden', 'embiid' ] 2. Array.filter() array에서 특정 조건을 가지고 필터링할 수 있다. const data = [..