Я создал один класс @RestController и пытаюсь использовать / refre sh значения привода с сервера конфигурации. / refre sh привод не работает. Я получаю ниже ошибки. Весенняя загрузочная версия 2.0.0-Release. Я не могу обновить версию весенней загрузки.
http://localhost: 8888 / secondservice / admin / refre sh
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Jan 23 10:16:10 EST 2020
***There was an unexpected error (type=Method Not Allowed, status=405).
Request method 'GET' not supported***
Зависимость: -
<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>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
Foo.Class
@RefreshScope
@RestController
public class Foo {
@Value("${welcome.message}")
private String personName;
@RequestMapping(value ="/", produces = "application/json", method = RequestMethod.POST)
public String greet(){
return "hello " + "POST "+ personName;
}
}
bootstrap .yml
server:
port: 8888
spring:
application:
name: secondservice
cloud:
config:
uri: http://localhost:8890/configserverdemo
fail-fast: false
enabled: true
server:
bootstrap: true
management:
context-path: /admin
security:
enabled: false
endpoints:
web:
exposure:
include: "*"
endpoint:
refresh:
enabled: true