1월, 2022의 게시물 표시

Spring Boot Admin Server, Client config 설정하기

이미지
 Spring Boot로 많은 프로젝트를 진행하게 됩니다. 많은 모니터링 도구가 있지만, Spring Boot 어플리케이션을 쉽게 모니터링 할 수 있는 방법을 소개하려고 합니다.   코드 중심으로 살펴보겠습니다. 1. 어드민 서버 구축 1-1. 디펜던시 추가 dependencies { // https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-starter-server implementation 'de.codecentric:spring-boot-admin-starter-server:2.5.4' } 1-2. 어드민 서버 설정 활성화 @SpringBootApplication @EnableAdminServer public class ServerApplication { public static void main (String[] args) { SpringApplication. run (ServerApplication. class, args) ; } } EnableAdminServer를 하면 됩니다. 2. 클라이언트 서버 설정  예제는 book-client, member-client 2가지 클라이언트, member-client가 2개의 인스턴스 실행으로 작성했습니다.  2-1 디펜던시 추가 dependencies { // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web implementation 'org.springframework.boot:spring-boot-starter-web:2.5.4' // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-actuator implementation 'org.spring...

자바스크립트 Array 를 map 으로 변환, 일부만 변경, 합치기

javascript array to map Array(배열, 리스트, List)를 map으로 변환하여 특정키의 값이 존재하는지 여부를 찾고 싶을 때가 있습니다. (저는 자바를 주로 사용하기 때문에 자바 stream의 collect  사용하고 싶었습니다.) Array to map, list to map const books = [ { id : 'a' , name : '1' , author : 'q' } , { id : 'b' , name : '2' , author : 'w' } , { id : 'c' , name : '3' , author : 'e' } ] ; // array to map , list to map const bookMap = books. reduce ((acc , currentValue) => { acc[currentValue. id ] = currentValue ; return acc ; } , {}) ; console . log (bookMap) ; const newBooks = [ { id : 'b' , name : 'n2' , author : 'w' } , { id : 'c' , name : 'n3' , author : 'e' } , { id : 'd' , name : 'n4' , author : 'r' } , { id : 'f' , name : 'n5' , author : 't' } ] // 이전에 등록된 데이터 확인하기 const oldBooks = newBooks. filter (each => !bookMap[each. id ]) console . log (oldBooks) acc의 이전 결과 내...