• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring bean name and annotations

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We use a vendor package that accesses spring beans via the bean "name" as in <bean name="/proxy">...</bean>. As we upgrade to spring 3.0 we are trying to use annotation configuration instead of xml.

Since the bean name can include values that are not allowed in bean id's, is there a method for doing this in annotations i.e. Component, Repository...?

Thanks
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joe Chambers wrote:We use a vendor package that accesses spring beans via the bean "name" as in <bean name="/proxy">...</bean>. As we upgrade to spring 3.0 we are trying to use annotation configuration instead of xml.

Since the bean name can include values that are not allowed in bean id's, is there a method for doing this in annotations i.e. Component, Repository...?

Thanks



Yes, you can put the name of the bean directly in the annotation

@Repository("MyBeanNameHere")

But in most cases when you are using annotations that are @Components, then you are also using @Autowired, so bean names at that point become not necessary.

Mark
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic