목록전체 글 (99)
Java / Spring

이전에 특정 도메인의 Mapper 인터페이스에 @Mapper 라는 어노테이션을 설정해서 xml 파일이 해당 mapper 인터페이스를 참조할 수 있도록 하였는데 만약 추가될 Mapper 인터페이스가 여러개면 모든 Mapper 인터페이스에 같은 어노테이션을 적용해야한다. 이럴 때 @MapperScan 이라는 어노테이션을 적용한다. 먼저 프로젝트의 config 패키지에 mybatis 환경설정을 위한 MyBatisConfig 객체를 생성한다.package kr.co.pei.pei_app.config.mybatis;import org.mybatis.spring.annotation.MapperScan;import org.springframework.context.annotation.Configuration;@Con..

개인 프로젝트를 진행하면서 MyBatis 를 학습 하기 위해서 특정 도메인의 모든 쿼리를 MyBatis 를 적용하기로 하였다. 1. SpringBoot 의 build.gradle 에 MyBatis 라이브러리를 추가 2. application.properties 또는 .yml 에 아래와 같이 Mapper 설정 mybatis.type-aliases-package : xxMapper.xml 에서 파라미터 타입 또는 resultType 으로 받거나 반환하기 위한 객체가 존재하는 위치를 prefix 설정을 통해 전체 경로를 parameterType 등의 값으로 적지 않더라도 해당 객체를 자동으로 매핑 할 수 있게 된다. type-aliase 설정을 하지 않으면 전체 도메인 패키지를 parameterType 에 ..

Boolean 또는 boolean 타입과 관련한 Java Bean 규칙, JackSon 직렬화 규칙 DTO 나 Entity 필드명을 isVisible 로 하고 boolean (primitive) 타입으로 선언하면 기본적으로 Jackson 은 visible 이라는 이름으로 응답한다. 이유 : Jackson 은 Java Bean 명명 규칙을 따르기 때문에 @Data@NoArgsConstructorpublic class AdminUpdateSurveyDTO implements AdminSurveyCheckTimeSupport { private boolean isVisible; 위와 같이 isVisible 타입의 필드를 서버에서 Response 했을 때 자동으로 아래와 같이 필드명이 변경 된다. 첨에 ..
// 🔆 compision API 에서 axios 사용 (중요 까먹지 말것))const handleLogin = async () => { try { const response = await axios.post("/login", { username: username.value, password: password.value }, { headers: { "Content-Type" : "application/json" }, }); store.dispatch('login', response.headers['authorization']); } catch (error) { console.log('handleLogin error', error); }}항상 옵션 API 만 사용하다가 이번 프로젝트에서 대부분의 v..

사용자의 활동 로그의 상세 내용을 RDB 의 특정 컬럼에 JSON 형태로 저장하여 필요한 key 로 데이터를 조회하기 위한 엔티티 필드타입을 json 으로 변환후 저장하는 로직을 구현 하였다. 먼저, gradle 에 hibernate 에서 제공하는 의존성을 추가해준다// HIBERNATEimplementation 'io.hypersistence:hypersistence-utils-hibernate-60:3.3.1' 아래 코드는 사용자 활동 로그 추적 후, RDB 에 별도 기록을 위한 엔티티 객체이다@Entity@Table(name = "log")@Getter@NoArgsConstructor@AllArgsConstructor@EntityListeners(AuditingEntityListener.class..
1. docker network ls : 현재 존재하는 네트워크 목록 확인2. sudo docker network create --driver bridge [네트워크명] : 네트워크 생성3. docker network rm [네트워크명] : 네트워크 삭제4. docker start $(docker ps -aq) : 모든 컨테이너 시작5. docker stop $(docker ps -q) : 모든 컨테이너 종료
1. 클래스 이름 변경 fn + shift + F62. 코드 자동 줄맞춤 cmd + option + L

메타 데이터 테이블이란?@Primary 로 설정한 데이터 베이스 테이블 application.propertiesspring.datasource-meta.driver-class-name=com.mysql.cj.jdbc.Driverspring.datasource-meta.jdbc-url=jdbc:mysql://localhost:3306/meta?useSSL=false&useUnicode=true&serverTimezone=Asia/Seoul&allowPublicKeyRetrieval=truespring.datasource-meta.username=rootspring.datasource-meta.password=javaspring.datasource-data.driver-class-name=com.mysql...
JDBC API 를 SPRING BOOT 에서 사용하기 위해 gradle 에 의존성을 주입하고 빌드를 실행하였다.implementation 'org.springframework.boot:spring-boot-starter-jdbc'그리고 mysql 을 연동하기 위해 application.properties 에 아래와 같이 변수를 설정하였다spring.datasource-meta.driver-class-name=com.mysql.cj.jdbc.Driverspring.datasource-meta.url=jdbc:mysql://localhost:3306/meta?useSSL=false&useUnicode=true&serverTimezone=Asia/Seoul&allowPublicKeyRetrieval=true..
문제 : 프로젝트를 진행하면서 비동기로 넘어온 데이터와 라우터 푸시를 동시에 사용하다보니 원하는 결과를 얻지 못하고 계속 데이터가 손실 되었다. code) MyInfo.vuetemplate> div class="custom-modal-overlay"> div class="custom-modal"> h3>아이디와 비밀번호를 입력해주세요h3> input type="text" v-model="username"/> input type="password" v-model="password" /> button @click="fetchMyInfoCheck">button> div> div>template> ..