I have a bean that is responsible for some calculations that depend on data in the database. It’s in the global module and I tried injecting DataManager and doing following:
@PostConstruct
public void init() {
this.mydata = dataManager.load(MyClass.class).list();
}
But I get the following nested exception: application context is not initialized
Hi,
That’s right, the code need system authentication so that DataManager would know whether to apply any security restrictions to the result list.
First, I would suggest to move the bean either to the core or to the web module, or at least separate bean implementations.
Because core and web use different system authentication methods.
Finally, if you want to cache some data on the web layer, I would suggest you to study and use com.haulmont.cuba.client.sys.cache.ClientCacheManager and com.haulmont.cuba.client.sys.cache.CachingStrategy classes. They provide
These are internal classes and they are not documented, however they are used in several places by the CUBA itself and you will save your bugfixing time if adopt them.