Merge pull request #8342 from kwoyke/BAEL-19878

BAEL-19878: Upgrade spring-cloud-zuul to Spring Boot 2.2.2 and Spring…
This commit is contained in:
Loredana Crusoveanu 2019-12-12 23:07:47 +02:00 committed by GitHub
commit 5feb614709
4 changed files with 8 additions and 28 deletions

View File

@ -73,8 +73,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-cloud.version>Finchley.SR1</spring-cloud.version>
<spring-boot.version>2.0.6.RELEASE</spring-boot.version>
<spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
<spring-boot.version>2.2.2.RELEASE</spring-boot.version>
</properties>
</project>

View File

@ -12,10 +12,6 @@
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>

View File

@ -1,11 +1,9 @@
package com.baeldung.web.controller;
import com.baeldung.web.dto.Foo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -13,22 +11,15 @@ import javax.servlet.http.HttpServletResponse;
import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import static org.apache.commons.lang3.RandomStringUtils.randomNumeric;
@Controller
@RestController
public class FooController {
public FooController() {
super();
}
// API - read
@RequestMapping(method = RequestMethod.GET, value = "/foos/{id}")
@ResponseBody
@GetMapping("/foos/{id}")
public Foo findById(@PathVariable final long id, HttpServletRequest req, HttpServletResponse res) {
// System.out.println(req.getHeaderNames());
// System.out.println("------" + req.getHeader("Test"));
if (req.getHeader("Test") != null) {
res.addHeader("Test", req.getHeader("Test"));
}
return new Foo(Long.parseLong(randomNumeric(2)), randomAlphabetic(4));
}

View File

@ -1,22 +1,15 @@
package com.baeldung.web.dto;
public class Foo {
private long id;
private String name;
public Foo() {
super();
}
public Foo(final long id, final String name) {
super();
this.id = id;
this.name = name;
}
//
public long getId() {
return id;
}