I
I
ilya814205662018-10-20 12:53:44
Java
ilya81420566, 2018-10-20 12:53:44

Spring. How to make an alias to another alias?

Let's say we have a bin:

<alias name="foo" alias="foo"/>
    <bean id="foo" class="com.foofoo.foo"/>

I want my bean to be called instead of it by the name foo, I
write like this:
<alias name="bar" alias="foo"/>
        <bean id="bar" class="com.barbar.bar"/>

but the error expected single matching bean but found 2 falls,
how can I implement the desired behavior?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ilya81420566, 2018-10-20
@ilya81420566

I added primary="true" to my bean and everything worked for me

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question