diff spring-cloud-config-client/src/main/java/de/comline/config/controller/HelloController.java @ 20:452cfefb0e1e default tip

Einfache Spring Application, die ihre config aus dem Spring Cloud Config Server liest
author Dirk Olmes <dirk.olmes@codedo.de>
date Thu, 17 Sep 2020 17:25:15 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/spring-cloud-config-client/src/main/java/de/comline/config/controller/HelloController.java	Thu Sep 17 17:25:15 2020 +0200
@@ -0,0 +1,16 @@
+package de.comline.config.controller;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class HelloController {
+	@Value("${greeting:ERROR - No greeting configured}")
+	private String greeting;
+	
+	@RequestMapping("/")
+	public String index() {
+		return greeting;
+	}
+}