You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by Mark Struberg <st...@yahoo.de.INVALID> on 2019/11/04 07:20:51 UTC

Re: @ConfigProperty is always NULL

Hi Alexey!

Let's start with the obvious: is your MyApplication bean managed by the container?
Or did it get created via new()?
And what scenario are you using? WAR or EAR deployment?

LieGrue,
strub


> Am 29.10.2019 um 13:26 schrieb Makarov Alexey <al...@gmail.com>:
> 
> Hello!
> I use Wildfly 18, maven and Delta Spike. When I try to resolve property config by programmatic lookup, property value is received successful:
> 
> Integer v = ConfigResolver.resolve("myproperty")
>   .as(Integer.class)
>   .withDefault(12345)
>   .getValue();
> 
> But if I try to inject this property, this value is always null:
> 
> @ApplicationScoped
> public class MyApplication {
> 
>   @Inject
>   @ConfigProperty(name = "myproperty", defaultValue = "12345")
>   private String myProperty;
> 
> ...
> }
> 
> How I can fix this problem?
> Thanks