• 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
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

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

 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 55
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

You can try modifying your Map creation in spring as:
 
H Paul
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
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

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
 
reply
    Bookmark Topic Watch Topic
  • New Topic