공부 (30) 썸네일형 리스트형 [SpringBoot] YamlPropertySourceFactory 기록 - 클래스 설정 public class YamlPropertySourceFactory implements PropertySourceFactory { @Override public PropertySource createPropertySource(String name, EncodedResource resource) throws IOException { Properties propertiesFromYaml = loadYamlIntoProperties(resource); String sourceName = name != null ? name : resource.getResource().getFilename(); return new PropertiesPropertySource(sourceName, properti.. 소수점 표현시 주의점과 Java의 BigDecimal 사용 컴퓨터는 2진수를 사용하기때문에 소수점을 표현하는데는 한계가 있고 오차가 발생한다. 돈과 관련된 도메인에서는 이는 매우 치명적이며 주의해야한다. public class Test { public static void main(String[] args) { double a = 0.1; double b = 0.2; double c = 0.3; System.out.println(a + b); System.out.println(a + b == c); } } 0.30000000000000004 false 정확한 소수점 계산들을 사용하기 위해서는 각 언어에서는 이를 지원해주는 라이브러리들이 있다. - Java : math.BigDecimal - JS : Big.js 라이브러리 - python : import deci.. [H2] Intellij IDE에 embedded H2 연동 .properties/yml 를 다음과 같이 설정 AUTO_SERVER=TRUE spring: datasource: url: jdbc:h2:~/{DB 이름};AUTO_SERVER=TRUE;MODE=MySQL;DB_CLOSE_DELAY=-1 Intellij 콘솔에서 Connection Type을 Embedded로 설정 후 URL을 jdbc:h2:~/{DB 이름};AUTO_SERVER=TRUE 와 같이 동일하게 맞출 것 H2에서 제공하는 AutoMatic Mixed Mode를 이용한다. IntelliJ 에서 embedded H2에 연결하기 개요 SpringBoot를 사용하여 로컬에서 개발할 때 H2를 많이 사용하게 된다. h2는 일반적으로 h2-console이라는 웹 콘솔을 사용하여 데이터를 조회하고 조작할.. [Docker] docker-compose.yml 기록용 docker-compose.yml 예시 services: mysql: user: X:X # 포트번호 image: mysql:8.0.32 ports: - X:X # 포트번호 container_name: my_container volumes: # {연결될 실제 물리 folder path}:/{docker 안에 folder path} - ./.mysql:/var/lib/mysql # {sql path}:/docker-entrypoint-initdb.d - ./src/main/resources/initdb:/docker-entrypoint-initdb.d command: - '--character-set-server=utf8mb4' - '--collation-server=utf8mb4_unicode_520_ci.. [Spring] Hibernate Enum 사용시 type 문제 문제발생 - Hibernate 6 이후 Schema-validation: wrong column type encountered in column [status] in table [user]; found [varchar (Types#VARCHAR)], but expecting [enum ('registered','unregistered') (Types#ENUM)] 다음과 같은 문제 발생 class UserEntity, enum UserStatus @Entity @Table(name = "user") public class UserEntity extends BaseEntity { ... @Column(nullable = false, length = 50) @Enumerated(EnumType.STRING) .. [MySQL] utf8mb4 (ut8mb4_0900 사용시 주의점) mysql 사용중 여러 character set이 혼동되는 경우가 있다. utf8mb4_unicode_ci utf8mb4_unicode_520_ci utf8mb4_general_ci utf8mb4_bin utf8mb4_0900_ai_ci 등.. - 0900 : 데이터 정렬 알고리즘 버전 - ai ( accent insensitivity ) : 악센트 구분 없음 - ci ( case insensitivity ) : 대소문자 구분 없음 bin collation 각 문자를 hex값 기준으로 판단하기 때문에, 알파벳 대소문자, 반각/전각, 이모지 등을 다른 값으로 판단한다. SELECT '😀' COLLATE utf8mb4_unicode_ci = '🤣' COLLATE utf8mb4_unicode_ci AS uni.. [hibernate] properties/yml 설정 SpringBoot3/Hibernate6 binding parameter 확인 logging.level.org.hibernate.orm.jdbc.bind=trace ex) org.hibernate.orm.jdbc.bind : binding parameter (1:INTEGER) [AWS] 플랫폼 후크를 사용한 Elastic Beanstalk 권한 설정 https://repost.aws/ko/knowledge-center/elastic-beanstalk-platform-hooks 플랫폼 후크를 사용해 Elastic Beanstalk 사용자 지정 플랫폼 후크를 사용하여 사용자 지정 스크립트 또는 기타 실행 파일을 생성하여 AWS Elastic Beanstalk 환경을 사용자 지정하고자 합니다. 해당 환경에서 실행되는 Amazon Elastic Compute Cloud(Amazon EC2) 인스 repost.aws 리액트 권한문제 발생 web: > react-scripts start web: sh: /var/app/current/node_modules/.bin/react-scripts: Permission denied project-root/ |-- .pl.. 이전 1 2 3 4 다음