我创建了一个 @RestController 类并尝试使用来自配置服务器的 /refresh 执行器值。/刷新执行器不工作。我遇到以下错误。Spring boot版本是2.0.0-Release。我无法升级 Spring Boot 版本。
http://localhost:8888/secondservice/admin/refresh
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***
Run Code Online (Sandbox Code Playgroud)
依赖性:-
<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>
Run Code Online (Sandbox Code Playgroud)
Foo.Class
@RefreshScope
@RestController
public class Foo {
@Value("${welcome.message}")
private …Run Code Online (Sandbox Code Playgroud) 缺少第二个 (00) 从 LocalDateTime.parse
LocalTime time = LocalTime.NOON;
DateTimeFormatter formatTime = DateTimeFormatter.ofPattern("HH:mm:ss");
String value ="20200810" + time.format(formatTime);
LocalDateTime localDateTime = LocalDateTime.parse(value, DateTimeFormatter.ofPattern("yyyyMMddHH:mm:ss"));
Run Code Online (Sandbox Code Playgroud)
日志
LocalTime time = LocalTime.NOON;
DateTimeFormatter formatTime = DateTimeFormatter.ofPattern("HH:mm:ss");
String value ="20200810" + time.format(formatTime);
LocalDateTime localDateTime = LocalDateTime.parse(value, DateTimeFormatter.ofPattern("yyyyMMddHH:mm:ss"));
Run Code Online (Sandbox Code Playgroud)
我也尝试更改LocalTime.NOON为,LocalTime.of(12,0,0)但结果仍然相同。