i have got module and this module only read config from server via async callbacK:
@Singleton
public class Config {
private ConnectionSettings connectionSettings;
@Inject
protected Config(final MainRPCAsync mainRpc) {
configureConnection(mainRpc);
}
private void configureConnection(MainRPCAsync mainRpc) {
Log.debug("****Configure connection..");
mainRpc.getConfig(new AsyncCallback<Configuration>() {
@Override
public void onSuccess(Configuration result) {
Log.debug("-----------Get config");
//initialize configuration settings
});
}
});
and next this class Config
is injected to another module but when i need to get configSettings
from that module i get only null
....
and in log console i read info that line Log.debug("-----------Get config");
show info after all ...
Its possible be sure that connection settings will be initialized by rpc async before injection that class to another module ?
I have the same need. I want to pass the result into a widget created with GIN.
UPDATE I resolved with Assisted Injection. So, I create my widget into success method of async service, and I use the result for create my widget.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.