annotate spring-boot-playground/src/main/java/de/comline/spring/controller/HelloController.java @ 18:8504317b9a09

Erweiterung um Sleuth, manuelle Konfiguration von Spring
author Dirk Olmes <dirk.olmes@codedo.de>
date Thu, 17 Sep 2020 09:03:11 +0200
parents 60afb461bf6c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
1 package de.comline.spring.controller;
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
2
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
3 import org.springframework.web.bind.annotation.RequestMapping;
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
4 import org.springframework.web.bind.annotation.RestController;
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
5
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
6 import de.comline.spring.model.json.Greeting;
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
7
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
8 @RestController
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
9 public class HelloController {
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
10 @RequestMapping("/")
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
11 public String index() {
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
12 return "Greetings from Spring Boot!\n";
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
13 }
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
14
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
15 @RequestMapping(path = "/", consumes = "application/json", produces = "application/json")
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
16 public Greeting sayHello() {
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
17 return new Greeting(index());
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
18 }
60afb461bf6c Import des Spring boot playground
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
19 }