In my case I am trying to use Environment class to read properties. I tried two options.
Option 1 -  I tried to use @Autowired the Enviornment class as shown in the following example.
@Service("idmHelper")
public class IdmHelper {
    @Autowired
    Environment env;
    public IdmHelper() {
       env.getProperty('property-name')
       ...
   }
}
Here it gives a NullPointerException. Becuase env is null.
Option 2 -  I tried to use @Autowired inside the constructor as an argument, as shown in the following example.
@Service("idmHelper")
public class IdmHelper {
    public IdmHelper(@Autowired Environment env) {
       env.getProperty('property-name')
       ...
   }
}
Here the env will get an object and I can access the properties. But I am getting the following error;
I am new to spring-boot, can someone explain why I am getting this error. I doubt that it is something to do with initiating the constructor. Please correct me If I am wrong.
This is my full code; Full-code-of-idm-helper-class
 
    