*
The moose likes Spring and the fly likes Beginning Spring: Syntax for Map<Integer, Double>? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Beginning Spring: Syntax for Map<Integer, Double>?" Watch "Beginning Spring: Syntax for Map<Integer, Double>?" New topic
Author

Beginning Spring: Syntax for Map<Integer, Double>?

H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 394


Using Spring, is it possible to creat a Map<Integer, Double>? If so, what is the syntax? Any pointer.
so that I can percentageLookup = springContext.getBean("percentageLookup");


With above config, the key is of type String, String.

percentageLookup.get("100") = 2
percentageLookup.get(100) = null

1M Thanks.
N Sahni
Ranch Hand

Joined: Jul 07, 2011
Posts: 55

Hi,

You can try modifying your Map creation in spring as:


Thanks and Regards,
Nilesh Sahni | nsahni@infocepts.com | www.infocepts.com
H Paul
Ranch Hand

Joined: Jul 26, 2011
Posts: 394
1. Suggested code works.
2.

Some where we refer Pricer.DEFAULT_PCT.

Syntax-wsie: How can it be declared in Spring configuration file and refer to it?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

H Paul wrote:1. Suggested code works.
2.

Some where we refer Pricer.DEFAULT_PCT.

Syntax-wsie: How can it be declared in Spring configuration file and refer to it?


You can use the <util:constant> tag to use a constant value in your configuration.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Beginning Spring: Syntax for Map<Integer, Double>?
 
Similar Threads
Problem with <util:map - Invalid nested exception is org.xml.sax.SAXParseException
Spring Related-- @Autowired with Map<String, myObjectType> is not initialized in the IoC container
Split an object over multiple config files in Spring ?
Spring IOC issues in MVC WebApplication with JSF integration
Doubt regarding maps key type while bnding