I have Utility class as below.
class Utility{
@Inject
@Named("endpoint")
private String endpoint; //generated only getter
}
I am configuring value for endpoint in the as below.
public class ConfigModule extends AbstractModule {
@Override
protected void configure() {
bindConstant().annotatedWith(Names.named("endpoint"))
.to("Endpoint URL");
}
}
In my GWT class I am trying to get this value.
public class MyUIPanel extends Composite {
@Override
protected void onLoad() {
Window.Location.assign(new Utility().getEndpoint());
}
}
UI loaded properly with error coming up in browser console saying You are executing Names.named() in GWT code. GWT does not emulate enough of Java that will work.
Also tried to inject Utility class in MyUIPanel class using guice but getting below error at the time of building war Binding requested for constant key Key[type=java.lang.String, annotation=@com.google.inject.name.Named(value=CognitoEndpoint)] but no explicit binding was found.