This is an automated email from the ASF dual-hosted git repository.
lprimak pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shiro.git
The following commit(s) were added to refs/heads/main by this push:
new e02e76474 bugfix(sample): SpringBoot 3 sample works again, fixed
missing status code in error attributes
e02e76474 is described below
commit e02e76474fb57f754011052bd4312e01ef290399
Author: lprimak <[email protected]>
AuthorDate: Tue Jun 17 18:29:16 2025 -0500
bugfix(sample): SpringBoot 3 sample works again, fixed missing status code
in error attributes
---
.../java/org/apache/shiro/samples/RestrictedErrorController.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git
a/samples/spring-boot-3-web/src/main/java/org/apache/shiro/samples/RestrictedErrorController.java
b/samples/spring-boot-3-web/src/main/java/org/apache/shiro/samples/RestrictedErrorController.java
index 6fb0bc6e2..35a46721f 100644
---
a/samples/spring-boot-3-web/src/main/java/org/apache/shiro/samples/RestrictedErrorController.java
+++
b/samples/spring-boot-3-web/src/main/java/org/apache/shiro/samples/RestrictedErrorController.java
@@ -19,7 +19,6 @@
package org.apache.shiro.samples;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.web.error.ErrorAttributeOptions;
import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
@@ -30,6 +29,9 @@ import
org.springframework.web.context.request.ServletWebRequest;
import jakarta.servlet.http.HttpServletRequest;
import java.util.Map;
+import static
org.springframework.boot.web.error.ErrorAttributeOptions.Include.MESSAGE;
+import static
org.springframework.boot.web.error.ErrorAttributeOptions.Include.STATUS;
+import static org.springframework.boot.web.error.ErrorAttributeOptions.of;
/**
*
@@ -48,8 +50,7 @@ public class RestrictedErrorController implements
ErrorController {
@RequestMapping(ERROR_PATH)
String error(HttpServletRequest request, Model model) {
Map<String, Object> errorMap = errorAttributes.getErrorAttributes(
- new ServletWebRequest(request),
-
ErrorAttributeOptions.of(ErrorAttributeOptions.Include.MESSAGE));
+ new ServletWebRequest(request), of(STATUS, MESSAGE));
model.addAttribute("errors", errorMap);
return "error";
}