BAEL-19878: Upgrade spring-cloud-zuul to Spring Boot 2.2.2 and Spring Cloud Hoxton
This commit is contained in:
parent
4c9417cff1
commit
2a419fc261
@ -73,8 +73,8 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<spring-cloud.version>Finchley.SR1</spring-cloud.version>
|
<spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
|
||||||
<spring-boot.version>2.0.6.RELEASE</spring-boot.version>
|
<spring-boot.version>2.2.2.RELEASE</spring-boot.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -12,10 +12,6 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package com.baeldung.web.controller;
|
package com.baeldung.web.controller;
|
||||||
|
|
||||||
import com.baeldung.web.dto.Foo;
|
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.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
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.randomAlphabetic;
|
||||||
import static org.apache.commons.lang3.RandomStringUtils.randomNumeric;
|
import static org.apache.commons.lang3.RandomStringUtils.randomNumeric;
|
||||||
|
|
||||||
@Controller
|
@RestController
|
||||||
public class FooController {
|
public class FooController {
|
||||||
|
|
||||||
public FooController() {
|
@GetMapping("/foos/{id}")
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
// API - read
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/foos/{id}")
|
|
||||||
@ResponseBody
|
|
||||||
public Foo findById(@PathVariable final long id, HttpServletRequest req, HttpServletResponse res) {
|
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) {
|
if (req.getHeader("Test") != null) {
|
||||||
res.addHeader("Test", req.getHeader("Test"));
|
res.addHeader("Test", req.getHeader("Test"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Foo(Long.parseLong(randomNumeric(2)), randomAlphabetic(4));
|
return new Foo(Long.parseLong(randomNumeric(2)), randomAlphabetic(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,22 +1,15 @@
|
|||||||
package com.baeldung.web.dto;
|
package com.baeldung.web.dto;
|
||||||
|
|
||||||
public class Foo {
|
public class Foo {
|
||||||
|
|
||||||
private long id;
|
private long id;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public Foo() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Foo(final long id, final String name) {
|
public Foo(final long id, final String name) {
|
||||||
super();
|
|
||||||
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user