This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Spring and the fly likes Aliasing in Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Aliasing in Spring" Watch "Aliasing in Spring" New topic
Author

Aliasing in Spring

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
What is the advantage of aliasing beans in spring?

kunal
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30057
    
149

One reason I can think of is if you are reusing different jars/components and they require different names. For example, suppose on needs a "abcDatasource" and the other needs a "defDataSource." You want to refer to the same bean and only declare it once. Aliasing solves this problem.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
wood burning stoves
 
subject: Aliasing in Spring
 
Similar Threads
But you don't look straight!
Question on Aliases
WA #1.....word association
Frameworks
My SCEA Part 1Study Notes