Spring: How to inject a String bean to the constructor?
You will have to name the bean, and then use the @Qualifier
annotation when autowiring referencing that name.
Example:
Config.java
public class Config {
private final String p = "Prop";
@Bean(name="p")
public String getP(){return p;}
}
SomeC.java
public class SomeC {
private String p;
@Autowired
public SomeC(@Qualifier("p") String p) {
this. p = p;
}
}