在 Spring Roo 的列表中使用转换器
现在我找到了 如何在 Spring Roo 中的 HTML SELECT 中使用转换器< /a>,我正在尝试在列表中执行相同的操作。
我设法在我的 ApplicationConversionServiceFactoryBean 中注册了一个转换器,但现在我在显示我的嫉妒列表时也需要使用它。我有以下实体:
@RooJavaBean
@RooToString
@RooEntity
public class Environment {
@NotNull
@Size(min = 2, max = 30)
private String name;
@ManyToOne
private Application application;
}
当在生成的 MVC 中将其显示为列表时,应用程序看起来像显示为 toString() 并且不使用注册的转换器。
我缺少什么?
Now that I found how to use converters in an HTML SELECT in Spring Roo, I am trying to do the same in a list.
I managed to register a Converter in my ApplicationConversionServiceFactoryBean, but now I need to use it as well when displaying a list of my envities. I have the following entity :
@RooJavaBean
@RooToString
@RooEntity
public class Environment {
@NotNull
@Size(min = 2, max = 30)
private String name;
@ManyToOne
private Application application;
}
When displaying it as a list in the generated MVC, it looks like the application is displayed as a toString() and not using the registered converter.
What am I missing ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将 Roo 生成的转换器方法推入重构为应用程序转换工厂 bean。
有时,默认情况下使用
toString()
方法进行转换。或者,您可以尝试推入并覆盖实体本身内的
toString()
方法。执行此操作时,您必须删除@RooToString
注释。干杯!!!
You need to push-in refactor the Roo generated converter method to the application conversion factory bean.
Sometimes, by default
toString()
method is used for the conversion.Alternatively, you can try pushing in and overriding the
toString()
method within the entity itself. You will have to remove the@RooToString
annotation while doing this.Cheers!!!