Config Null Pointer when Injected

If I extend com.haulmont.cuba.core.config.Config;

e.g.


@Source(type = SourceType.DATABASE)
public interface MyConfig extends Config {

    @Property("my.value")
    String getMyValue();
}

How can I get that to load first when I create a new bean? e.g.


@Service(XeroService.NAME)
public class MyServiceBean implements MyService {

    @Inject
    MyConfig myConfig;

  
    @PostConstruct
    public instantiate(){

        System.out.println(myConfig.getMyValue());

      
    }

I keep getting a null pointer error on “System.out.println(myConfig.getMyValue());” Is there any way around this?

Hello,

I’ve prepared an example and attached it in your previous topic: link.
Please take a look at this and give me your feedback.

Best regards,
Daniil.