I am trying to learn spring framework static method dependency injection, there are many questions posted already but my problem is different, in that I have taken one class
package com.model;
public class Test {
private static String name;
//private static Engine engine;
public static void setName(String name) {
Test.name = name;
}
public static void printData(){
System.out.println("Helllo: "+name);
}
}
and want to inject one property call name and checking does it support regular DI by injecting data using spring.xml
spring.xml contains
<bean id="t" class="com.model.Test">
<property name="name" value="Vishal"/>
</bean>
passing value through property and in main
ApplicationContext ap = new ClassPathXmlApplicationContext("resources/spring.xml");
Test test = (Test)ap.getBean("t");
test.printData();
while I am running this code it works fine.
I doesn't come to know how it support instead of throwing some exception as spring doc it has to pass through
org.springframework.beans.factory.config.MethodInvokingFactoryBean
I am using spring 4, whats wrong with my code??