• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

HttpTraceRepository를 찾을수가없는데 어떻게해야하나요

23.01.09 23:58 작성 조회수 1.39k

0

메이븐에 dependency추가해도

HttpTraceRepository를 찾을수없는데 어떻게 진행해야할까요?ㅜ

 

답변 2

·

답변을 작성해보세요.

2

이강민님의 프로필

이강민

2023.03.17

네. 아래 댓글 분의 말씀처럼 Spring 3 버전부터 HttpTrace 대신 HttpExchanges로 이름이 변경되었습니다.

자세한 내용은 맨 아래 링크를 참고하시면 될 것 같고,

application.yml 에는 httptrace 대신 httpexchanges를 적어주고, ApigatewayServiceApplication 클래스에선 HttpTraceRepository 대신 HttpExchangeRepository를 적어주면 됩니다.

 

https://www.appsdeveloperblog.com/how-to-enable-actuators-httptrace-in-spring-boot-3/

0

안녕하세요, 이도원입니다.

말씀하신 HttpTraceRepository는 actuator에 대한 dependency만 가지고 있으면 실행하실 수 있습니다. pom.xml 파일에 적용된 내용이 실제로 메이븐 빌드를 통해 반영된 것이 맞는지 한번 확인해 보시는게 좋을 것 같습니다. 첨부하는 아래 이미지를 참고하시면, Intellij의 왼쪽 Project 메뉴에서 External Libraries 항목을 보시면, pom.xml 파일에 지정했던 dependency에 대한 패키지 항목이 보이는데, 여기해서 org.springframework.boot:spring-boot-acturoa:2.7.6 (최신버전으로 확인했을 때 입니다) 항목에서 해당 HttpTraceRepository 클래스가 확인되는지 확인해 보시기 바랍니다.

추가로 올려주신 이미지를 보면 main 메소드에 붉은색으로 오류가 발생한 것처럼 보이는데, 이부분도 어떤 이유인지 확인해 보시면 좋을 것 같습니다.

image

감사합니다.

heepaanee님의 프로필

heepaanee

2023.02.20

spring boot 3.x 부터 변경되었다고 합니다.

Spring Boot 3.0 Migration Guide · spring-projects/spring-boot Wiki · GitHub

'httptrace' Endpoint Renamed to 'httpexchanges'

The httptrace endpoint and related infrastructure records and provides access to information about recent HTTP request-response exchanges. Following the introduction of support for Micrometer Tracing, the name httptrace may cause confusion. To reduce this possible confusion the endpoint has been renamed to httpexchanges. The contents of the endpoint’s response has also been affected by this renaming. Please refer to the Actuator API documentation for further details.

Related infrastructure classes have also been renamed. For example, HttpTraceRepository is now named HttpExchangeRepository and can be found in the org.springframework.boot.actuate.web.exchanges package.

import org.springframework.boot.actuate.web.exchanges.HttpExchangeRepository;
import org.springframework.boot.actuate.web.exchanges.InMemoryHttpExchangeRepository;
@Bean
public HttpExchangeRepository httpTraceRepository() {
  return new InMemoryHttpExchangeRepository();
}