spring - Spring Webflow - 转换器类型的问题
问题描述
我最近更新到 spring sts 4 所以我不确定是否有什么东西导致了这个问题,因为我之前没有这个错误。
我已经确保从数据库中获取的用户对象是一个用户对象,并且应该被传递到下一行代码中
错误信息
org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type
[com.paphos.pos.users.Users] to type [@javax.persistence.ManyToOne @javax.persistence.JoinColumn com.paphos.pos.users.Users]
网络流
<evaluate result="user" expression="usersService.getCustomerById(1)"></evaluate>
<evaluate expression="order.users = flowScope.user"></evaluate>
用户服务
@Entity
@Table(name = "users")
@StaticMetamodel(Users.class)
public class Users implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int idusers;
private String username;
private String password;
private int enabled = 0;
private String authority;
@Size(max = 25)
private String name;
@Size(min = 10, max = 10)
private String phoneNo;
@Size(min = 10, max = 10)
private String loyalty;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "users")
private List<Timecard> timecard = new ArrayList<>();
订单
@Entity(name="orders")
public class Orders implements Serializable {
private static final long serialVersionUID = -8538332203504273656L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int idorders;
@ManyToOne
@JoinColumn(name = "idusers")
private Users users;
@ManyToOne
@JoinColumn(name = "createdBy")
private Users createdBy;
@ManyToOne
@JoinColumn(name = "driver")
private Users driver;
@ManyToOne(cascade = { CascadeType.ALL })
@JoinColumn(name = "idaddresses")
private Addresses addresses;
private double pretax;
private double tax;
private double total;
@ManyToOne
@JoinColumn(name = "idstatus")
private Status status;
private String timeOrdered;
private int discounted;
private int tipped;
private Double due;
@OrderColumn
@OneToMany(fetch = FetchType.EAGER, cascade = { CascadeType.REMOVE }, mappedBy = "orders")
private Set<Orderitem> orderitem;
private double disAmount;
private double tipAmount;
private int paid;
我尝试将结果指定为 flowscope 或任何其他类型的变量,但没有任何效果。该错误也非常令人困惑,因为它是相同的类型,只是上面有注释。也许它与 webflow 配置有关,因为我在其他任何地方都没有收到此错误。如上所述,我刚刚更新到 sts 4,所以我要回到版本 3,看看是否是问题所在。任何帮助,将不胜感激。
解决方案
这个错误是由 pom.xml 中的 spring 开发工具引起的。从我的代码中删除它后,它开始工作。不知道为什么会这样。
推荐阅读
- kubernetes - 当 `cgroup_manager=systemd` 时使用 cri-o 运行 pod 和容器
- python - 如何从数据集中的其余部分中选择一行并将其添加到python中的初始矩阵中?
- javascript - 如果操作数有小数,正则表达式可防止逗号分隔符
- java - 如何使自动递增数字Java
- angular - 集成 Google 地图 API 时,Angular5 应用程序未在 IE11 中加载
- react-final-form - 当外部组件的状态发生变化时,改变 React 最终表单字段的值
- java - GlobalFilter 与 WebFilter
- python - 从 itertools 组合列表结果中删除括号
- mysql - 为什么 MYSQL AND oparator 在尝试提取同一列中的数据时不起作用?
- python - 是否有可以从 Excel 中获取的数据中去除撇号的功能?