From a8169cce0b790442b5f70eb0094cd0675714e1c7 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 6 Nov 2017 21:18:55 +0000 Subject: [PATCH] Upgrade Boot-based samples to Spring Boot 2.0.0.M6 Closes gh-444 --- samples/rest-notes-slate/build.gradle | 2 +- samples/rest-notes-spring-data-rest/pom.xml | 2 +- samples/rest-notes-spring-hateoas/build.gradle | 2 +- .../notes/ExceptionSupressingErrorAttributes.java | 9 +++++---- samples/testng/build.gradle | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/samples/rest-notes-slate/build.gradle b/samples/rest-notes-slate/build.gradle index c488bb3e..e25dd23b 100644 --- a/samples/rest-notes-slate/build.gradle +++ b/samples/rest-notes-slate/build.gradle @@ -3,7 +3,7 @@ buildscript { maven { url 'https://repo.spring.io/milestone' } } dependencies { - classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M1' + classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M6' } } diff --git a/samples/rest-notes-spring-data-rest/pom.xml b/samples/rest-notes-spring-data-rest/pom.xml index 6fe49288..7e2b8308 100644 --- a/samples/rest-notes-spring-data-rest/pom.xml +++ b/samples/rest-notes-spring-data-rest/pom.xml @@ -11,7 +11,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.0.M1 + 2.0.0.M6 diff --git a/samples/rest-notes-spring-hateoas/build.gradle b/samples/rest-notes-spring-hateoas/build.gradle index 68cc359d..5a4f206a 100644 --- a/samples/rest-notes-spring-hateoas/build.gradle +++ b/samples/rest-notes-spring-hateoas/build.gradle @@ -3,7 +3,7 @@ buildscript { maven { url 'https://repo.spring.io/milestone' } } dependencies { - classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M1' + classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M6' } } diff --git a/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/ExceptionSupressingErrorAttributes.java b/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/ExceptionSupressingErrorAttributes.java index bc05ff62..dbac5854 100644 --- a/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/ExceptionSupressingErrorAttributes.java +++ b/samples/rest-notes-spring-hateoas/src/main/java/com/example/notes/ExceptionSupressingErrorAttributes.java @@ -18,19 +18,20 @@ package com.example.notes; import java.util.Map; -import org.springframework.boot.autoconfigure.web.servlet.error.DefaultErrorAttributes; +import org.springframework.boot.web.servlet.error.DefaultErrorAttributes; import org.springframework.stereotype.Component; import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.WebRequest; @Component class ExceptionSupressingErrorAttributes extends DefaultErrorAttributes { @Override - public Map getErrorAttributes(RequestAttributes requestAttributes, + public Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) { - Map errorAttributes = super.getErrorAttributes(requestAttributes, includeStackTrace); + Map errorAttributes = super.getErrorAttributes(webRequest, includeStackTrace); errorAttributes.remove("exception"); - Object message = requestAttributes.getAttribute("javax.servlet.error.message", RequestAttributes.SCOPE_REQUEST); + Object message = webRequest.getAttribute("javax.servlet.error.message", RequestAttributes.SCOPE_REQUEST); if (message != null) { errorAttributes.put("message", message); } diff --git a/samples/testng/build.gradle b/samples/testng/build.gradle index 1a61f1d8..7b654c5f 100644 --- a/samples/testng/build.gradle +++ b/samples/testng/build.gradle @@ -3,7 +3,7 @@ buildscript { maven { url 'https://repo.spring.io/milestone' } } dependencies { - classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M1' + classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.0.0.M6' } }