In the first two posts of this series, I described the bean definition profiles feature, and how it relates to the
Environment abstraction new in Spring 3.1 M1. Today we’ll take a look at a second aspect of the
Environment – how it helps simplify the concern of configuration property management.
Understanding property sources
Environment abstraction provides search operations over a configurable hierarchy of property sources. To explain fully, consider the following:
ApplicationContext ctx = new GenericApplicationContext(); Environment env = ctx.getEnvironment(); boolean containsFoo = env.containsProperty("foo"); System.out.println("Does my environment contain the 'foo' property? " + containsFoo);