본문 바로가기

▶ Back-End/Java55

SpringBoot + Cassandra 연동(Multi Node) Docker에 설치한 Cassandra(Multi Node)와 SpringBoot 연동*spring-boot-starter-parent 2.3.10.RELEASE 기준*Docker에 Application을 올리는 과정*자세한 설명 생략  ▷ 이슈 사항 확인 !! 이슈 → Local Host에서 Multi Node를 연동할 때 Docker Network 문제 발생*SpringBoot는 Docker Containerr IP로 노드에 연결 시도*Single Host Multi Node(Docker Container) 환경에서 발생 *Error log[WARN ] : [s0|/172.19.0.3:9042] Error while opening new channel (ConnectionInitException: .. 2023. 8. 18.
SpringBoot + Cassandra 연동(Single Node) Docker에 설치한 Cassandra(Single Node)와 SpringBoot 연동*spring-boot-starter-parent 2.3.10.RELEASE 기준*자세한 설명 생략 ▷ Project 전체 구조*파일 이름으로 검색 가능   ▷ Coulmn Family Create*Cassandra 설치 방법 아래 관련 글 참고*example을 위한 Table /** KEYSPACE 생성 */-- CREATE KEYSPACE testDB WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor': 2};-- → class : -- → SimpleStrategy : 단일 데이터 센터-- → NetworkTopologyStrategy : 멀.. 2023. 8. 9.
Cassandra 설치 방법과 간단한 Node 분산 Test Docker를 이용해 Cassandra를 간단하게 설치할 수 있다.*단일 노드 / 다중 노드(Cluster) 설치방법 중 선택해서 사용*단일 노드 설치방법을 진행했다면 모든 과정을 초기화하고 진행*다중 노드(Cluster)  설치 방법은 단일 호스트에서 진행*docker-compose를 사용해도 됨*자세한 설명 생략   ▷ 바로이동    ① 다중 호스트에서 다중 노드 설치 방법    ② 단일 노드 설치 방법    ③ 다중 노드 설치 방법    ④ Node 분산 Test  ▷ 다중 호스트에서 다중 노드 설치 방법*Docker Cluster(Swarm 모드)구성▶ Node 1 💡docker run --name cassandra-node1 -v cassandra-node1:/var/lib/cassandra.. 2023. 8. 8.
SLF4J 기본 사용 방법 spring-boot-starter 에는 SLF4J와 Logback이 기본으로 설정 돼있다.*자세한 설명 생략  ▷ SLF4J란?     - Simple Logging Facade 4 Java     - 다양한 Logging Framework를 하나의 방식으로 사용할 수 있는 방법을 제공        *Logging Framework : java.util.logging, logback, log4j     - Spring Boot는 SLF4J + Logback을 사용        *Logback : SLF4J의 구현체이자 Logging Library(log4j보다 더 좋은 성능)  ▷ 기본 사용 방법*Spring boot에서 아래 2가지 방법 중 선택해서 사용    ① Logger객체 직접 생성    ② .. 2023. 8. 7.
Custom Annotation 생성 Example 간단한 Custom Annotation 생성, 확인*메타 어노테이션 관련 자세한 설명 생략*Reflection 설명 생략  import java.lang.annotation.ElementType;import java.lang.annotation.Retention;import java.lang.annotation.RetentionPolicy;import java.lang.annotation.Target;/** * 사용자 정의 어노테이션 생성 */@Target(ElementType.TYPE) // @interface 어노테이션의 적용 위치를 설정하는 옵션@Retention(RetentionPolicy.RUNTIME) // @interface 어노테이션의 적용범위로 어떤 시점까지 사용될 지 결정하는 옵션@in.. 2023. 7. 26.
SpringBoot Maria DB + MyBatis 설정 *자세한 설명 생략  ▷ Project 전체 구조*파일 이름으로 검색 가능*이전 MQTT Client + WebFlux 구축 관련 Project에 이어서 진행(아래 관련 글 참고)   ▷ Table Create*example을 위한 Table CREATE TABLE `test`.test ( topic VARCHAR(255) NOT NULL, message VARCHAR(255) NOT NULL);INSERT INTO `test`.test (topic, message)VALUES ('1','HELLO-1'), ('2','HELLO-2'), ('3','HELLO-3'), ('4','HELLO-4'), ('5','HELLO-5');SELECT * FROM `test`.test;  ▷ build.grad.. 2022. 12. 6.
SpringBoot에서 MQTT Client + WebFlux 구축 WebFlux를 적용한 MQTT Client를 구축하고Topic 메시지 도착 시 Callback으로 Bean을 통해 서비스 구분*Mqtt Broker(mosqitto) 아래 관련 글 참고*자세한 설명 생략  ▷ Project 전체 구조*파일 이름으로 검색 가능   ▷ build.gradle   ▷ application.properties   ▷ MqttApplication.java*아무 작업하지 않음   ▷ MqttPublishVO.java*MqttController 발행 요청 VO   ▷ MqttSubscribeVO.java*MqttController 구독 요청 VO   ▷ MqttController.java   ▷ UserController.java   ▷ MqttService.java   ▷ A/B.. 2022. 12. 2.
SpringBoot JSP 설정 Spring Boot에 내장된 Tomcat은 JSP을 지원하지 않는다.*gradle 사용*자세한 설명 생략  ▷ build.gradle*의존성 추가 implementation 'javax.servlet:jstl'implementation 'org.apache.tomcat.embed:tomcat-embed-jasper'  ▷ application.properties*Spring Boot Jsp View 경로 설정 spring.mvc.view.prefix=/WEB-INF/jsp/spring.mvc.view.suffix=.jsp  ▷ Jsp 파일 생성*위 설정한 경로와 맞게 생성   ▷ 결과 확인 2022. 12. 1.
JWE Example(nimbus) JWE Create / Parse*JWT 관련 자세한 설명 생략  ▷ Example /** * JWE (JSON Web Encryption) 암호화 및 복호화 예시 * * ▶ JWE (JSON Web Encryption) * → 서버와 클라이언트 간 암호화된 데이터를 토큰화한 것 * → 클라이언트에게 전달되는 데이터가 암호화되어 기밀성 보장 * * ▶ JWT (JSON Web Token) * → JWS & JWE를 포함 * → 서버와 클라이언트 간 정보를 주고받을 때 HTTP 요청 헤더에 JWT 토큰을 포함하여 인증 수행 * → 구성: * → Header: 토큰의 타입 및 암호화 알고리즘 * → Payload: claim 정보 (name: value), 공개/비공개 설.. 2022. 10. 21.
728x90
728x90