title: Myfaces CODI, @Inject and memory usage
body: <p>I use Myfaces CODI @ViewAccessScoped backing beans in my JSF application. One of the
  benefits is that I don't need to use view parameters to communicate information between
  views. For the record @ViewAccessScoped ensures that a bean is accessible until until the first request of a new view doesn't access it. Take this case where I want to pass a string value from page1 to page2:</p>
  
  <h2>Page1Bean.java (backing bean for page1.xhtml)</h2>
  
  <pre><code>@Inject private Page2Bean page2Bean;
  private String source = "Hello, World!";
  
  ...
  page2Bean.setTarget(source);
  </code></pre>
  
  <h2>Page2Bean.java (backing bean for page2.xhtml)</h2>
  
  <pre><code>private String target;
  </code></pre>
  
  <p>If I navigate directly from page1 to page2, then when I access #{page2Bean.target} from
  page2 it has the value "hello, world!".</p>
  
  <p>In effect I'm pushing the data from the page1 view to the page2 view. The other option is
  to pull the data from the page1 view into the page2 view, so in the page2Bean I @Inject
  Page1Bean and @ViewAccessScoped ensures that I can access page1Bean.getSource() (as long
  as it was in the previous view).</p>
  
  <p>This is all well and good, but in the real world I may want to navigate from page1 to any
  one of a number of other pages, depending on user input. So Page1Bean.java ends up looking
  like this:</p>
  
  <h2>Page1Bean.java (revised)</h2>
  
  <pre><code>@Inject private Page2Bean page2Bean;
  @Inject private Page3Bean page3Bean;
  @Inject private Page4Bean page4Bean;
  @Inject private Page5Bean page5Bean;
  @Inject private Page6Bean page6Bean;
  @Inject private Page7Bean page7Bean;
  @Inject private Page8Bean page8Bean;
  </code></pre>
  
  <p>Now for my question: does the memory footprint of page1Bean always include page2Bean-
  page8Bean? or will memory only be used if I access one of the @Inject'ed beans at
  runtime?</p>
  
  <p>I hope this isn't too naive a question, but I'm not sure exactly how it will work and
  if the answer to the first question is yes, I'm more or less ending up using
  @SessionScoped!.</p>
  
  <p>Thanks for any clarification.</p>