title: What is the difference between spring parent context and child context?
body: <p>I was reading spring doc the core container I want to understand the purpose of <strong>ref parent</strong> when inject collaborators then I found this notion of parent context child context or parent container and current container this is the part that I'm confuse about it : 
  <a href="https://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#beans-ref-element" rel="noreferrer">This part of doc </a></p>
  
  <blockquote>
    <p>Specifying the target bean through the parent attribute creates a
    reference to a bean that is in a parent container of the current
    container. The value of the parent attribute may be the same as either
    the id attribute of the target bean, or one of the values in the name
    attribute of the target bean, and the target bean must be in a parent
    container of the current one. You use this bean reference variant
    mainly when you have a hierarchy of containers and you want to wrap an
    existing bean in a parent container with a proxy that will have the
    same name as the parent bean.</p>
  </blockquote>
  
  <pre><code>&lt;!-- in the parent context --&gt;
  &lt;bean id="accountService" class="com.foo.SimpleAccountService"&gt;
      &lt;!-- insert dependencies as required as here --&gt;
  &lt;/bean&gt;
  &lt;!-- in the child (descendant) context --&gt;
  &lt;bean id="accountService" &lt;!-- bean name is the same as the parent bean --&gt;
      class="org.springframework.aop.framework.ProxyFactoryBean"&gt;
      &lt;property name="target"&gt;
          &lt;ref parent="accountService"/&gt; &lt;!-- notice how we refer to the parent bean --&gt;
      &lt;/property&gt;
      &lt;!-- insert other configuration and dependencies as required here --&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>can someone give me some help or an example of this two type of context ? and what is the purpose of the <strong>ref parent</strong>  Thank you in advance </p>