我得到那些奇怪的,非静态的'当我运行'激活器编译时,从2.4升级到2.5后出现错误:
2222
XptoConverter:
non-static method <T>register(java.lang.Class<T>,play.data.format.Formatters.SimpleFormatter<T>) cannot be referenced from a static context
public MyController() {
Formatters.register(Xpto.class, new XptoConverter());
}
答案 0 :(得分:2)
这些方法不再是静态的;注入Formatter。见https://www.playframework.com/documentation/2.5.x/JavaForms#Register-a-custom-DataBinder。另请参阅https://github.com/playframework/playframework/pull/5734
你必须
public class FormattersProvider implements Provider<Formatters>
(进行转化)public class FormattersModule extends AbstractModule
FormattersModule
application.conf
醇>