Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
H Paul
Ranch Hand
Posts: 471
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 55
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

You can try modifying your Map creation in spring as:
 
H Paul
Ranch Hand
Posts: 471
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic