Explanation with example for @Qualifier

Let’s say we have two beans qualified to be injected then we go for this.

Change code as below :


Now we will see how we can inject primitives from property files.

Change spConfig.xml as below.

  • We need to inform spring where is out properties file located.

  • Create property file in resources folder

  • Use annotation @value for injecting values.

  • Value may be multiple [comma separated ] or single

  • Client for invocation

  • We are using this for DB Connection in this case.

Spconfig.xml


DB.properties


DBUtil.java