解决重定向:Cannot convert value of type 'SysRole' to required type 'String'
程序员文章站
2024-01-03 18:20:40
...
- 断点报错代码
ra.addAttribute("sysRole", sysRole);
ra就是RedirectAttributes
- 具体报错如下
org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'cn.hctech2006.boot.bootmvc.bean.SysRole' to required type 'java.lang.String'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'cn.hctech2006.boot.bootmvc.bean.SysRole' to required type 'java.lang.String': no matching editors or conversion strategy found
- 解决:记错了应该是addFlashAttribute
ra.addFlashAttribute("sysRole", sysRole);
结果
推荐阅读
-
Cannot convert value of type ‘java.lang.String‘ to required type ‘org.apache.ibatis.session.SqlSessi
-
解决重定向:Cannot convert value of type 'SysRole' to required type 'String'
-
java.lang.IllegalStateException: Cannot convert value of type ‘java.lang.String‘ to required type ‘c
-
Failed to convert property value of type [java.lang.String] to required type [java.util.Date]