분류 전체보기
-
스프링 부트 모니터링(2.1) - Health 엔드포인트 탐구Web/환경설정 관련 2024. 5. 14. 16:02
Health 엔드포인트에 접근하면, 애플리케이션과 애플리케이션에서 사용되는 여러 컴포넌트의 상태를 전반적으로 파악할 수 있다. 스프링 부트는 애플리케이션 컴포넌트별로 다양한 HealthIndicator를 제공하는데, 이 중 DiskSpaceHealthIndicator와 PingHealthIndicator와 같은 일부 구현체는 항상 기본으로 제공한다. 1. 좀 더 자세한 정보보기 Health 엔드포인트로 애플리케이션에 대한 좀 더 자세한 정보를 수집해보자 management.endpoint.health.show-details=always#총 3가지 값을 지정할 수 있다.# always = 상태 상세 정보를 항상 표시 # naver = 기본 값이며, 상세 정보를 표시하지 않는다.# when-authoriz..
-
스프링 부트 모니터링 (1) - 액추에이터 기본 설정Web/환경설정 관련 2024. 5. 14. 13:57
액추에이터란 스프링 부트 애플리케이션 모니터링과 관리에 필요한 기능을 제공운영에 필요한 광범위한 기능을 직접 구현할 필요 없이 쉽게 사용할 수 있다. 1. 액추에이터 기본 설정 액추에이터 관련 의존관계를 추가한다. // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-actuatorimplementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: '3.2.4'spring-boot-starter-actuator에는 spring-boot-actuator-autoconfigure와 micrometercore 의..
-
스프링 부트 - 실패 분석기Web/환경설정 관련 2024. 5. 14. 12:59
실패 분석기란 애플리케이션에서 발생한 실패/예외를 감지하고 해당 이슈를 이해하는 데 도움이 되는 정보 제공 장점에러에 대한 상세한 메시지를 제공해서 문제의 근본 원인과 해결책을 결정할 수 있게 돕는다.애플리케이션 시작 시점에 검증을 수행해서 발생할 수 있는 에러를 가능한 빨리 파악할 수 있다. 1. 실패 분석 시나리오 요구 사항의존하고 있는 외부 REST 서비스를 사용할 수 있는지 애플리케이션 시작 시점에 확인서비스 사용 불가 시 상세한 내용 확인시나리오애플리케이션이 강아지의 상세 정보를 외부 API https://dog.ceo/dog-api/에서 가져온다.해당 API가 제대로 작동하지 않으면, 애플리케이션을 실행할 수 없음으로 API상태를 점검해야한다. 작업 절차 ContextRefreshedEnv..
-
스프링 부트 구성 - @Import, @Conditional 활용Web/환경설정 관련 2024. 5. 13. 23:11
자동 구성 이란? 스프링 애플리케이션 개발에 필요한 컴포넌트를 자동으로 설정 해주는 기능 ex 빌드 설정에 spring-boot-starter-web 의존성 추가하면, 필요한 라이브러리 다 같이 가져오는 것 공통 Configuraion class 작성하고 이를 받아와서 환경을 구성하는 방법을 알아보자 1. 공통 Confuguration 사용 임의로 하나 만들었다. 이를 jar파일로 만든 후 다른 프로젝트에서 가져와보자 1.2 Gradle 수정 repositories { //.. flatDir{ //대상 폴더 지정 dirs 'C:\\Users\\won\\Desktop\\document\\spring\\workspace\\manyConfig\\cslib' }}dependencies { //jar 파일..
-
문제 풀이에 자주 사용하는 순열,조합자료구조와 알고리즘/문제풀기 2024. 5. 11. 01:06
순열과 조합을 사용하는 문제가 굉장히 자주 등장한다. 순열과 조합을 구하는 탬플릿 사이 사이에 원하는 연산만 추가하면 된다. 이를 정리해두고 자주 보고, 연습해서 필요할 때 빠르게 구현하려고 적어둔다. 1.순열 1.1 순열 - 원소 중복 x private static void RecursivePermutation(int depth){ //BASE CASE if(depth == r){ //.. 여기서 순열이 완성되면 할 일 // 대표적으로 +1해서 경우의 수를 count한다던지 // 아니면, 해당 순열에 해당하는 값을 쭉 나열한다던지.. }else{ //RECURSIVE CASE ..
-
BFS - 백준1194 달이 차오른다,가자 - 장애물 변동에서 탐색 (+테스트케이스 추가)자료구조와 알고리즘/문제풀기 2024. 5. 11. 00:12
달이 차오른다, 가자. 시간 제한메모리 제한제출정답맞힌 사람정답 비율2 초128 MB181897592515338.747%문제지금 민식이가 계획한 여행은 달이 맨 처음 뜨기 시작할 때 부터, 준비했던 여행길이다. 하지만, 매번 달이 차오를 때마다 민식이는 어쩔 수 없는 현실의 벽 앞에서 다짐을 포기하고 말았다.민식이는 매번 자신의 다짐을 말하려고 노력했지만, 말을 하면 아무도 못 알아들을 것만 같아서, 지레 겁먹고 벙어리가 되어버렸다. 결국 민식이는 모두 잠든 새벽 네시 반쯤 홀로 일어나, 창 밖에 떠있는 달을 보았다.하루밖에 남지 않았다. 달은 내일이면 다 차오른다. 이번이 마지막기회다. 이걸 놓치면 영영 못간다.영식이는 민식이가 오늘도 여태것처럼 그냥 잠 들어버려서 못 갈지도 모른다고 생각했다. 하지..
-
스프링 부트 애플리케이션 시작 시 코드 실행 (CommandLineRunner)Web/환경설정 관련 2024. 5. 10. 19:39
스프링 부트 애플리케이션을 시작할 때 특정 코드를 실행해야 할 때가 있다. ex) 애플리케이션 초기화 이전에 데이터 베이스 초기화 스크립트를 실행, 혹은 외부 REST 서비스를 호출해서 데이터를 가져오는 등이를 위해 CommandLineRunner와 ApplicationRunner가 있다. 둘 다 run() 메서드만 있음으로, 적절히 구현 후 빈으로 등록해서 사용하자 (ApplicationRunner와 매우 유사하므로, CommandLineRunner만 다룸)CommandLineRunner는 args파라미터에 접근할 수 있기 때문에, 초기화 작업을 편리하게 할 수 있는 장점이 있다. 스프링 부트 애플리케이션 초기화 직전에 run(String... args)이 호출 된다. - CommandLineRunn..
-
Spring boot - 설정 파일 관리 (@Profile, @ConfigurationProperties,@Value,@PropertySource)Web/환경설정 관련 2024. 5. 10. 19:22
개발 프로젝트를 진행하는 방식에 따라 동일한 어플리케이션을 개발, 테스트, 스테이징, 상용 등 여러 환경에서 배포해야하는 경우가 있다.이때 배포 환경에 따라 소스코드는 거의 변경되지 않고, 설정 정보만 다르게 해야 배포 작업이 편할 것이다.따라서, 설정 정보를 외부화해서 관리 하는 방법 들에 대해서 알아보자 Property 관리의 여러 가지 방법 1. SpringApplication 클래스 활용 SpringApplication 클래스를 사용하여 설정 정보를 정의할 수 있다. 이 클래스에는 java.util.Properties 또는 Map를 인자로 받는다. setDefaultProperties에 위 Properties나 Map으로 설정한 내용을 넣으면 된다. 위 방식은 소스코드로 정의하는 방식이므로, 한..