This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Spring and the fly likes Injecting a Map in enum through Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Injecting a Map in enum through Spring" Watch "Injecting a Map in enum through Spring" New topic

Injecting a Map in enum through Spring

Arjun Reddy
Ranch Hand

Joined: Nov 10, 2007
Posts: 629
Hi All,

I have an Enum with few maps in it. Can I inject the maps through Spring? I am using Spring 2.5


Be Humble... Be Nice.
Bill Gorder

Joined: Mar 07, 2010
Posts: 1682

Enums are basically static, you cannot inject beans into them. I can think of a few hacks that might get a reference to a bean into an enum, but you can not inject it directly. You might wan't to think about the design of you application first though and see if there is a better way.

[How To Ask Questions][Read before you PM me]
I agree. Here's the link:
subject: Injecting a Map in enum through Spring
It's not a secret anymore!