Hello,

is there any way to get CDI working in a ConfigSource?

Basically, I am trying to define a custom ConfigSource, that injects a DAO to retreive the configuration parameters from a database. However, the ConfigSource is registered via META-INF/Services and the class is loaded very early, even before JNDI lookup or anything else works.

What I tried, for example, is something like

public class DatabaseConfigSource implements ConfigSource {

@Inject

private ConfigDao configDao;

public String|getPropertyValue(String key) {|

|if (configDao == null) {|

|BeanProvider.injectFields(this);
|

|}
|

|}
|

}

I cannot call BeanProvider.injectFields(this), because the class is instantiated so early, that there is no CDI context available.

Is there a way to get CDI to work for a custom ConfigSource?

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to