Tworzę projekt demo dla Spring-Config-Server
i Spring-Config-Client
.
W SpringBoot 1.5.6.RELEASE
wszystko działa dobrze.
Jednak kiedy aktualizuję projekt do 2.0.1.RELEASE
nie zapewnia punktów końcowych siłownika.
Punkt końcowy siłownika podany w 1.5.6. UWOLNIENIE
Mapped "{[/refresh || /refresh.json],methods=[POST]}"
Mapped "{[/dump || /dump.json],methods=[GET]
Mapped "{[/heapdump || /heapdump.json],methods=[GET]
Mapped "{[/autoconfig || /autoconfig.json],methods=[GET]
Mapped "{[/resume || /resume.json],methods=[POST]}"
Mapped "{[/configprops || /configprops.json],methods=[GET]
Mapped "{[/features || /features.json],methods=[GET]
Mapped "{[/loggers/{name:.*}],methods=[GET]
Mapped "{[/restart || /restart.json],methods=[POST]}"
...and many more
Punkt końcowy siłownika podany w 2.0.1. UWOLNIENIE
Mapped "{[/actuator/health],methods=[GET]
Mapped "{[/actuator/info],methods=[GET]
Mapped "{[/actuator],methods=[GET]
pom.xml : 2.0.1.RELEASE
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>utf-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.RC1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
Jedyna różnica mc 1.5.6
pom to wersja i spring-cloud.version = Dalston.SR2
Czy ktoś mógłby ci pomóc?
Odpowiedzi:
2 dla odpowiedzi № 1Po krótkich badaniach znalazłem przyczynę, dla której punkty końcowe nie są pokazane w Spring Boot 2.0
jest zgodnie z dokumentami
Domyślnie wszystkie punkty końcowe oprócz wyłączenia są włączone
więc musimy włączyć je ręcznie.
dodałem management.endpoints.web.exposure.include=*
w application.properties
plik, a teraz wszystkie punkty końcowe powróciły.
Uwaga: Jeśli używasz .yml
pamiętaj, aby użyć "*"
nie *
0 dla odpowiedzi nr 2
Ekspozycję punktów końcowych w protokole HTTP można teraz konfigurować przy użyciu właściwości
management.endpoints.web.exposure.include
management.endpoints.web.exposure.exclude
Możesz udostępniać punkty końcowe za pomocą identyfikatora wymienionego przez Actuator.
# Include all endpoints
management.endpoints.web.exposure.include=*
# Exclude specifics
management.endpoints.web.exposure.exclude=env