|
|
@@ -2,7 +2,8 @@ package com.mokasz.pool.image.restful.controller;
|
|
|
|
|
|
import com.mokasz.pool.image.restful.entity.IndexResponse;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.info.BuildProperties;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
@@ -12,8 +13,12 @@ import java.net.UnknownHostException;
|
|
|
@RestController
|
|
|
@RequiredArgsConstructor
|
|
|
public class IndexController {
|
|
|
- @Value("${pom.version}")
|
|
|
- private String version;
|
|
|
+ BuildProperties buildProperties;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ public IndexController(BuildProperties buildProperties) {
|
|
|
+ this.buildProperties = buildProperties;
|
|
|
+ }
|
|
|
|
|
|
private String getHostname() {
|
|
|
try {
|
|
|
@@ -25,6 +30,6 @@ public class IndexController {
|
|
|
|
|
|
@GetMapping("/")
|
|
|
public IndexResponse index() {
|
|
|
- return new IndexResponse(version, getHostname());
|
|
|
+ return new IndexResponse(buildProperties.getVersion(), getHostname());
|
|
|
}
|
|
|
}
|