Pārlūkot izejas kodu

增加配置文件读取

tags/v1.0.0^2
林万龙 pirms 3 gadiem
vecāks
revīzija
205257eb1e
2 mainītis faili ar 4 papildinājumiem un 3 dzēšanām
  1. +2
    -2
      src/main/java/com/telpo/dipperposition/config/PositionConfig.java
  2. +2
    -1
      src/main/java/com/telpo/dipperposition/controller/DipperPositionController.java

+ 2
- 2
src/main/java/com/telpo/dipperposition/config/PositionConfig.java Parādīt failu

@@ -16,11 +16,11 @@ import org.springframework.context.annotation.Configuration;
@Getter
@Setter
@ToString
@ConfigurationProperties("position")
@Configuration
@ConfigurationProperties(prefix = "position")
public class PositionConfig {

@Value("${hello}")
//@Value("${hello}")
private String hello;

}

+ 2
- 1
src/main/java/com/telpo/dipperposition/controller/DipperPositionController.java Parādīt failu

@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.ContextLoader;

import java.time.Duration;
import java.time.LocalDateTime;
@@ -25,6 +26,6 @@ public class DipperPositionController {

@RequestMapping("/getPos")
public String getPos() {
return "Helle world!";
return "Helle world!" + ContextLoader.getCurrentWebApplicationContext().toString();
}
}

Notiek ielāde…
Atcelt
Saglabāt