Bladeren bron

增加配置文件读取

tags/v1.0.0^2
林万龙 3 jaren geleden
bovenliggende
commit
205257eb1e
2 gewijzigde bestanden met toevoegingen van 4 en 3 verwijderingen
  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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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();
}
}

Laden…
Annuleren
Opslaan