Otho,

Just in case you are still looking for a solution...


Change how you declare your beans.  For example:

    <bean id="txProxyTemplate" abstract="true"

class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
        <property name="transactionManager">
            <ref local="transactionManager" />
        </property>
        <property name="transactionAttributes">
            <props>
                <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
                <prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
                <prop key="make*">PROPAGATION_REQUIRED</prop>
                <prop key="delete*">PROPAGATION_REQUIRED</prop>
                <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
            </props>
        </property>
    </bean>
    <bean id="authorityDAO" parent="txProxyTemplate">
        <property name="target">
           <!-- This is how to hide the second implementer of the interface
from Tapestry -->
            <bean

class="ca.itstrategic.fmp.portal.persistence.hibernate.AuthorityDAOImpl">
                <property name="sessionFactory">
                    <ref local="sessionFactory" />
                </property>
            </bean>
        </property>
    </bean>


The key piece is how you specify the target of the
TransactionProxyFactoryBean.  By using a <bean> declaration rather than a
reference to a bean, Tapestry only sees the outer proxy bean.


Jonathan


On Tue, Apr 7, 2009 at 1:58 PM, Otho <taa...@googlemail.com> wrote:

> Since Spring beans are not exposed anymore as services I get exceptions
> like
>
>
> Error obtaining injected value for field org.example.user.Login.dao: Spring
> context contains 2 beans assignable to type org.example.dao.Dao: dao,
> daoImpl.
>
> I couldn't find anything in the docs about injecting by name. And the
> proposes workaround for non singletons with injecting ApplicationContext
> and
> then get the bean by name/id  works, but is a bit awkward in cases like
> this.
>
> Is there some other possibility? If not, is support for injection by name
> planned in the future without the 5.0 compatibility mode?
>



-- 
Jonathan Barker
ITStrategic

Reply via email to