I want to centralize access to all my property values so that I can do things like make sure everyone uses the same name for properties, the same default values, etc. I created a class to centralize all of this, but I'm not sure how classes that need access to these values should get them, since you cannot autowire Strings.
My class looks something like this:
@Configuration public class SpringConfig { @Autowired @Value("${identifier:asdf1234}") public String identifier; }
Where can I use it in several classes
public class Foo { @Autowired private String theIdentifier; } public class Bar { @Autowired private String anIdentifier; }
source share