The bean should acts as a central service locator for my jsf beans, and apart from the per request initializations is works as a shine.
Logging info written in the beans' constructor shows that the bean is instantiated every time over. The constructors are public, so the bean is not a singleton; should it be?

the bean is injected into other managed beans like this:

    <managed-bean>
        <description>
            Service locator of the business services
        </description>
        <managed-bean-name>serviceLocatorBean</managed-bean-name>
        <managed-bean-class>
            com.dp.jsf.ServiceLocatorBean
        </managed-bean-class>
        <managed-bean-scope>application</managed-bean-scope>
    </managed-bean>

    <managed-bean>
        <managed-bean-name>CardsListBean</managed-bean-name>
        <managed-bean-class>com.dp.jsf.CardListBean</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
        <managed-property>
            <property-name>serviceLocator</property-name>
            <value>#{serviceLocatorBean}</value>
        </managed-property>
    </managed-bean>


Every time the CardsListBean is accessed, I see logging info from the service locator constructor. Is the way I inject the locator into the target bean correct or is this what causes the strange behaviour?

kind regards,

Peter


On 11/21/05, Bruno Aranda <[EMAIL PROTECTED]> wrote:
Something wrong may be happening. A bean in application scope should
only initialize one time and you can use it as long as your
application is alive without being initialized again... How are you
checking the initialization of that bean?

Bruno

2005/11/21, Peter Maas <[EMAIL PROTECTED]>:
> Hi all,
>
>  I tried to figure out if it is possible to share bean instances between
> different request. Currently the beans I have configured to be in
> application scope are instantiated for each request... is this the way it
> should work or am I doing something wrong?
>
>  regards,
>
>  Peter
>

Reply via email to