I know Constructors are calling before the auto wiring the variables. But, unfortunately, I want to read the application.properties value inside the constructor?
@Component
public class DESedeEncryption {
private static final String key = "TEST_KEY";
public DESedeEncryption() {
system.out.println(key);
}
}
DESedeEncryption encrypted = new DESedeEncryption();
For the above class, the object has been created by using a new operator in my project totally 108 places. Now, I want to read that key value from the application.properties. But, I need to change all 108 places by using @Autowired annotation. But, some of the places the object creation written by using "new" operator in entity class files. So, I can't auto wired the object inside the entity class.
Someone, please help me to solve this issue.