• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

actuator status: 404

22.02.09 23:09 작성 조회수 1.49k

0

spring : 2.6.x

swagger 3.0.x

actuator : 2.6.x

 

사용 중인데 

http://localhost:8080/actuator 실행시 404 에러가 생깁니다.

답변 2

·

답변을 작성해보세요.

6

gk95님의 프로필

gk95

질문자

2022.02.11

해결했습니다.

SwaggerConfig.java 안에 아래 bean 을 설정해 주면 됩니다.

기타 궁금한 사항은 

https://github.com/springfox/springfox/issues/3462 

여기 들어가면 있습니다.

	@Bean
	public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(WebEndpointsSupplier webEndpointsSupplier, ServletEndpointsSupplier servletEndpointsSupplier, ControllerEndpointsSupplier controllerEndpointsSupplier, EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties, Environment environment) {
	        List<ExposableEndpoint<?>> allEndpoints = new ArrayList();
	        Collection<ExposableWebEndpoint> webEndpoints = webEndpointsSupplier.getEndpoints();
	        allEndpoints.addAll(webEndpoints);
	        allEndpoints.addAll(servletEndpointsSupplier.getEndpoints());
	        allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints());
	        String basePath = webEndpointProperties.getBasePath();
	        EndpointMapping endpointMapping = new EndpointMapping(basePath);
	        boolean shouldRegisterLinksMapping = this.shouldRegisterLinksMapping(webEndpointProperties, environment, basePath);
	        return new WebMvcEndpointHandlerMapping(endpointMapping, webEndpoints, endpointMediaTypes, corsProperties.toCorsConfiguration(), new EndpointLinksResolver(allEndpoints, basePath), shouldRegisterLinksMapping, null);
	    }


	private boolean shouldRegisterLinksMapping(WebEndpointProperties webEndpointProperties, Environment environment, String basePath) {
	        return webEndpointProperties.getDiscovery().isEnabled() && (StringUtils.hasText(basePath) || ManagementPortType.get(environment).equals(ManagementPortType.DIFFERENT));
	    }

 

먼길님의 프로필

먼길

2022.02.22

덕분에 문제를 해결했습니다.

gk95님의 프로필

gk95

질문자

2022.02.25

^^

MyCatIsRockstar님의 프로필

MyCatIsRockstar

2022.03.03

천재이십니다 감사합니다

고산님의 프로필

고산

2022.04.24

와 진짜 천재이십니다 감사합니다

myloolkysad님의 프로필

myloolkysad

2022.07.10

추천!

0

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

actuator 관련 dependecy가 정상적으로 설정되었다면, Spring Boot나 Actuator의 버전은 상관없을 것 같습니다. 다음은 Spring Boot, Actuator를 2.6.2 버전으로 설정하였을 때의 결과화면입니다. 

    <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!-- <version>2.1.8.RELEASE</version>-->
<version>2.6.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

추가로, application.yml 파일에 autuator 사용을 위한 다음과 같은 설정이 추가되었는지 확인해 보시기 바랍니다.

management:
endpoints:
web:
exposure:
include: "*"

감사합니다.

gk95님의 프로필

gk95

질문자

2022.02.11

전 강의부터 다시 해보는데 actuator 추가 전까지 실행이 잘 되지만

 

	<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
			<version>2.6.2</version>
		</dependency>

추가하면서 

 

org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper';

 

에러가 발생합니다.

java : 1.8

spring : 2.6.x

swagger 3.0.0

actuator : 2.6.x