我有一个简单的演示者。声明对singleton类的调用
private RandomString randomString = RandomString.getInstance();在组装maven时,我遇到错误
[INFO] [ERROR] Error injecting by.gwttest.client.client.application.packet.PacketPagePresenter$MyProxy: Unable to create or inherit binding: No @Inject or default constructor found for by.gwttest.client.client.application.packet.PacketPagePresenter$MyProxy
[INFO] Path to required node:
[INFO]
[INFO] by.gwttest.client.client.application.packet.PacketPagePresenter$MyProxy [com.gwtplatform.mvp.client.gin.AbstractPresenterModule.bindPresenter(AbstractPresenterModule.java:121)]
[INFO]
[INFO] [ERROR] Error injecting by.gwttest.client.client.application.packet.PacketPageView$Binder: Unable to create or inherit binding: No @Inject or default constructor found for by.gwttest.client.client.application.packet.PacketPageView$Binder
[INFO] Path to required node:
[INFO]
[INFO] by.gwttest.client.client.application.packet.PacketPageView [com.gwtplatform.mvp.client.gin.AbstractPresenterModule.bindPresenter(AbstractPresenterModule.java:120)]
[INFO] -> by.gwttest.client.client.application.packet.PacketPageView$Binder [@Inject constructor of by.gwttest.client.client.application.packet.PacketPageView]
[INFO]
[INFO] [ERROR] Errors in 'gen/com/gwtplatform/mvp/client/DesktopGinjectorProvider.java'
[INFO] [ERROR] Line 8: Failed to resolve 'com.gwtplatform.mvp.client.DesktopGinjector' via deferred bindingRandomString ...
private RandomString() {
}
private static class RandomStringHolder {
private final static RandomString instance = new RandomString();
}
public static RandomString getInstance() {
return RandomStringHolder.instance;
}
...它能连接到什么?而不声明RandomString项目正在进行
发布于 2015-04-22 15:11:36
您的错误与RandomString无关。错误提示您缺少带@Inject注释的构造函数。
确保您的PacketPageView和PacketPagePresenter有一个用@Inject注释的空构造函数。
@Inject
public PacketPagePresenter() {
}发布于 2015-04-24 16:34:26
此代码中存在错误
private String convertMStoTime(long millis) {
//return null;
return String.format(
"%02d:%02d:%02d",
TimeUnit.MILLISECONDS.toHours(millis),
TimeUnit.MILLISECONDS.toMinutes(millis)
- TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS
.toHours(millis)),
TimeUnit.MILLISECONDS.toSeconds(millis)
- TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS
.toMinutes(millis)));
}GWT中的TimeUnit不是真正的
https://stackoverflow.com/questions/29781126
复制相似问题