홈>
Spring Boot 2.0에서 hystrix.stream을 활성화하는 방법을 찾지 못했습니다. http : // localhost : 8080/hystrix.stream 으로 이동하여 파일에 액세스하려고하면 404 파일을 찾을 수 없음 오류가 발생합니다.
컨트롤러에서 호출 된 메소드 :
@GetMapping("/")
public Mono<String> index(Model model) {
model.addAttribute("images",
imageService
.findAllImages()
.map(image -> new HashMap<String, Object>() {{
put("id", image.getId());
put("name", image.getName());
put("imageComments", commentHelper.getComments(image));
}})
);
return Mono.just("index");
}
CommentHelper 코드, @HystrixCommand가 사용 중임을 참고하십시오 :
@Component
public class CommentHelper {
private final RestTemplate restTemplate;
CommentHelper(RestTemplate restTemplate) {
this.restTemplate = restTemplate;
}
@HystrixCommand(fallbackMethod = "defaultComments")
public List<Comment> getComments(Image image) {
return restTemplate.exchange(
"http://COMMENTS/comments/{imageId}",
HttpMethod.GET,
null,
new ParameterizedTypeReference<List<Comment>>() {},
image.getId()).getBody();
}
public List<Comment> defaultComments(Image image) {
return Collections.emptyList();
}
}
<시간>
다음은 build.gradle의 종속성입니다.
dependencies {
compile 'org.springframework.boot:spring-boot-starter-webflux'
compile 'org.synchronoss.cloud:nio-multipart-parser'
compile 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive'
compile 'org.springframework.boot:spring-boot-starter-thymeleaf'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-devtools'
compile 'org.springframework.cloud:spring-cloud-starter-stream-rabbit'
compile 'org.springframework.cloud:spring-cloud-stream-reactive'
compile 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
compile 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix'
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile 'io.projectreactor:reactor-test'
compile 'junit:junit:4.12'
}
http : // localhost : 8080/application/features 로 이동하면 Hystrix는 다음과 같이 활성화됩니다 :
{
"enabled": [
{
"type": "com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect",
"name": "Hystrix",
"version": "1.5.12",
"vendor": null
},
{
"type": "com.netflix.discovery.EurekaClient",
"name": "Eureka Client",
"version": "1.8.4",
"vendor": null
},
{
"type": "org.springframework.cloud.client.discovery.composite.CompositeDiscoveryClient",
"name": "DiscoveryClient",
"version": "2.0.0.M3",
"vendor": "Pivotal Software, Inc."
},
{
"type": "org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient",
"name": "LoadBalancerClient",
"version": "2.0.0.M3",
"vendor": "Pivotal Software, Inc."
},
{
"type": "com.netflix.ribbon.Ribbon",
"name": "Ribbon",
"version": "2.2.2",
"vendor": null
}
],
"disabled": []
}
여기서 정확히 무엇이 잘못 되었습니까? 도움이된다면 여기에있는 코드를 따르려고합니다
https : //github.com/learning-spring-boot/learning-spring-boot-2nd-edition-code/tree/master/7/part2
학습 Spring Boot 2nd Edition을 진행하면서
- 답변 # 1
- 답변 # 2
management.endpoints.web.exposure.include=*
를 포함해야합니다 이 문제에 따른 application.properties에서 - 답변 # 3
management.endpoints.web.base-path=/
를 추가해야합니다. application.properties에서. 예를 들어, 이것을 확인하십시오.경로가 비어 있어야하므로
/actuator/hystrix.stream
로 올바르게 등록됩니다. .
관련 자료
- java - Spring 304를 사용하여 Cors 활성화
- java - Spring Security로 h2 콘솔 사용
- java - 스프링 부트 애플리케이션에서 SSL 활성화
- java - 스프링 JDBC에서 SQL 쿼리 콘솔 로깅을 활성화하는 방법
- java - 이러한 경우 제네릭을 사용할 때 스프링이 올바른 Bean을 주입하도록 설정하는 방법은 무엇입니까?
- 특정 URL에 스프링 필터를 사용하려면 어떻게해야합니까?
- 스프링 부트 부트 스트랩 속성 파일에서 모든 액추에이터 엔드 포인트를 활성화하는 방법은 무엇입니까?
- 스프링 AOP를 사용하여 스프링 EntityManager에서 최대 절전 모드 필터를 사용할 수 없습니다
관련 질문
- java : Firebase 클라우드 메시징에서 주제를 만드는 방법
- java : scheduler.pool.size를 사용하여 동시에 여러 작업을 실행하는 방법
- java : systemd에서 시작할 때 Spring 외부 구성 파일이로드되지 않습니다.
- java : maven-assembly-plugin이있는 Fatjar-META-INF /spring.factories에서 자동 구성 클래스를 찾을 수 없음
- java : Hibernate @Query가 필요한 출력을 생성하지 않음
- java : Spring Boot App이 시작된 직후에 항상 종료되는 이유는 무엇입니까?
- java : loadAll () 및 loadById (Long id)시 JSON 직렬화의 차이점
- java : spring-data /jpa로 '중복 항목'예외를 무시하는 방법
- java : Tomcat 10에 배포 한 후 Spring Boot 앱에 액세스 할 수 없음
- java : Hibernate 예외 : 관리 빈을 직접 인스턴스화 할 수 없습니다.
@EnableCircuitBreaker
추가 또는@EnableHystrix
@EnableHystrixDashboard
로 주석 .management.endpoints.web.exposure.include=*
추가 application.properties에서.Hystrix 대시 보드는 http : // localhost : 8080/hystrix에서 액세스 할 수 있습니다.
Hystrix 스트림 URL 입력에 http : // localhost : 8080/actuator/hystrix.stream을 입력하십시오.