Thursday, September 28, 2023

Create a bean of type java.util.properties

To create a bean of type java.util.properties in Java xml use the following code.


 <bean id="attendkey" class="java.util.Properties" name="attendenceKeys"/>  
 <bean id="attendkey.load" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">  
   <property name="targetObject"><ref bean="attendkey"/></property>  
   <property name="targetMethod"><value>putAll</value></property>  
   <property name="arguments">  
        <props>  
             <prop key="Present">1</prop>  
             <prop key="Absent" >-1</prop>  
       </props>  
  </property>  
 </bean>  

Example :

https://github.com/gauravmatta/springmvc/blob/master/book%20management%20system/src/main/java/com/springimplant/xml/config.xml

No comments:

Post a Comment

Spring Boot

What is circular/cyclic dependency in spring boot? When two services are interdependent on each other, that is to start one service, we requ...