<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <br>
    <div class="moz-cite-prefix">On 2/4/14 7:24 PM, Cantor, Scott wrote:<br>
    </div>
    <blockquote cite="mid:CF16EE37.8564%25cantor.2@osu.edu" type="cite">
      <pre wrap="">
</pre>
      <pre wrap="">
I thought you could set it on the beans element, maybe not. </pre>
    </blockquote>
    <br>
    I didn't think there was anything like a default scope for a beans
    file.<br>
    <br>
    Related, I had way back thought it might make sense to define
    abstract bean definitions for things that shared common properties
    or had other common characteristics (like 'scope').&nbsp; AFAIK, even
    there, the 'scope' property of a BeanDefinition is one of the things
    that is *not* inherited, so you have to define it on every leaf bean
    individually.&nbsp; At least that's what I understand from the docs (5.7
    Bean definition inheritance), where it says:<br>
    <br>
    <br>
    <blockquote type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      The remaining settings are <span class="emphasis"><em>always</em></span>
      taken from the child definition: <span class="emphasis"><em>depends
          on</em></span>, <span class="emphasis"><em>autowire mode</em></span>,
      <span class="emphasis"><em>dependency check</em></span>, <span
        class="emphasis"><em>singleton</em></span>, <span
        class="emphasis"><em>scope</em></span>, <span class="emphasis"><em>lazy

          init</em></span>.</blockquote>
    <br>
    <br>
    So sounds like no help via this approach either.<br>
    <br>
    <br>
    <br>
    <blockquote cite="mid:CF16EE37.8564%25cantor.2@osu.edu" type="cite">
      <pre wrap="">If not, I
guess we should do something, but there are likely going to be beans in
the flow bean files that would be singleton, so I don't know how we'd
limit the post-processor.
</pre>
    </blockquote>
    <br>
    I don't know how we would either, other than by reflection or
    instanceof on some interface.&nbsp; Would have to make sure that the
    assumptions there always held, or were define with enough
    specificity.<br>
    <br>
    On the original question: the purist in me says that beans in
    general should be marked accordingly to what they actually are and
    need, i.e. we shouldn't apply 'prototype' everywhere just to avoid
    mistakes.&nbsp; But I do recognize the drastic consequences of a bean
    failing to be marked as prototype where it should be.<br>
    <br>
    In general, though, aren't most or all of our bean definition files
    likely to have a mixture of scopes?&nbsp; So really, unless we can do
    something global or with a bean definition post processor, we pretty
    much just have to make sure to not make mistakes.&nbsp; (Which by the
    way, includes injecting a prototype or other non-singleton scoped
    bean into a singleton without doing the appropriate additional
    stuff).<br>
    <br>
    On a related note: have we had any use cases for scopes other than
    'singleton' and 'prototype', like 'request' or 'session'?&nbsp; Just
    wondering.&nbsp; For some other work I have recently been using both
    'session' scoped beans and the &lt;aop:scoped-proxy&gt; stuff to
    inject them into other 'singleton' beans, and it works nicely.<br>
  </body>
</html>