I have a class like this -
@Service
public class SomeClass {
@Autowired
Environment env;
private String property;
@Value("${pty}")
public void setPty(String pty) {
pty = environment.getProperty("pty");
}
}
I'm trying to inject the 'pty' variable from another class 'Environment' which is autowired and I get this exception when my server startups
Error creating bean with name 'someClass': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void service.facade.ActionFacade.setPty(java.lang.String); nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'pty' in string value "${pty}"