Meaningless Drivel is fun!*
The moose likes Spring and the fly likes Map across application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Map across application" Watch "Map across application" New topic
Author

Map across application

Navin Pillu
Ranch Hand

Joined: Apr 19, 2005
Posts: 103
Hi

We are using Spring 3.0. Here we want to use a HashMap. We want to initialize it when application loads at 1st time. Also it is modifiable at any time from any class. The modification should be available to all other classes across application whoever will use it.

Can any one suggest suitable strategy

Thanks
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1648
    
    7

You can define a Map as a @Bean if you wish. But you can not use @Autowire to wire it into your beans, you must use @Resource or @Inject. This is due to the semantics of @Autowired. See https://jira.springsource.org/browse/SPR-8519

Note that HashMap is not thread safe. You might want to consider ConcurrentHashMap


[How To Ask Questions][Read before you PM me]
 
 
subject: Map across application
 
Similar Threads
How to use onSearchRequested () of an Activity?
-XX:+ShowMessageBoxOnError
PersistentSet issue while using GWT+Spring+Hibernate+Gilead
-XX:+ShowMessageBoxOnError
iplanet remote debug