title: How to create a <bean> tag with the Environment in Spring 5
body: <p>In Spring you can do the following using annotations:</p>
  
  <pre><code>@Configuration
  @PropertySource(value = "classpath:props.properties")
  public class MyConfiguration {
      @Autowired
      Environment env;
  
      @Bean
      public MyBean myBean() {
          MyBean myBean = new MyBean;
          myBean.setEnv(env);
      }
  }
  </code></pre>
  
  <p>Is the injection of Environment possible from XML?
  I want something similar to:</p>
  
  <pre><code>&lt;context:property-placeholder location="classpath:props.properties"/&gt;
  &lt;bean id="env" class="org.springframework.core.env.Environment"/&gt;
  &lt;bean id="myBean" class="MyBean" p:env-ref="env"/&gt;
  </code></pre>
  
  <p>But I don't know if I could get properties from then env bean reference in the myBean bean declared in the XML.</p>