Spring-Spring CoreNo Comments

In this post, I will  show you how to inject values into collections type (List, Set, Map, and Properties).

This is common case we will face in real project, so there are 4 major collection types are supported :

  1. List – <list/>
  2. Set – <set/>
  3. Map – <map/>
  4. Properties – <props/>
  • Spring beans

A normal object, with four collection properties to using for example :

CarService : 

  • Configuration file

spring-core.xml : 

And now, let go to detail each of them :

  • List

  • Set

  • Map

  • Properties

Note :

If you want to pass null or empty value :

And if you want to inject a bean to collection : 

 

That’s it, just comment here or asking me in Questions tab if you have any question.

 

 

 


Be the first to post a comment.

Add a comment


Warning: stream_socket_client(): unable to connect to http://browscap.org/version (Unable to find the socket transport "http" - did you forget to enable it when you configured PHP?) in /home/javasail/public_html/wp-content/plugins/wp-statistics/vendor/browscap/browscap-php/src/phpbrowscap/Browscap.php on line 1366

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in /home/javasail/public_html/wp-content/plugins/wp-statistics/vendor/browscap/browscap-php/src/phpbrowscap/Browscap.php on line 1004