Spring Java

File: context.xml

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
                http://www.springframework.org/schema/beans
                http://www.springframework.org/schema/beans/spring-beans.xsd">
                dependency-check="simple">
        
    
            dependency-check="objects">
        
    
            dependency-check="all">
        
        
    
    

File: Main.java
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
public class Main {
  public static void main(String[] args) {
    XmlBeanFactory bf = new XmlBeanFactory(new ClassPathResource("context.xml"));
    System.out.println(bf.getBean("target1"));
    System.out.println(bf.getBean("target2"));
    System.out.println(bf.getBean("target3"));
  }
}
class SimpleBean {
  private int someInt;
  private SimpleBean nestedSimpleBean;
  public void setSomeInt(int someInt) {
    this.someInt = someInt;
  }
  public void setNestedSimpleBean(SimpleBean nestedSimpleBean) {
    this.nestedSimpleBean = nestedSimpleBean;
  }
  @Override
  public String toString() {
    final StringBuilder sb = new StringBuilder();
    sb.append("SimpleBean");
    sb.append("{someInt=").append(someInt);
    sb.append(", nestedSimpleBean=").append(nestedSimpleBean);
    sb.append('}');
    return sb.toString();
  }
}
           
       
Spring-dependencycheckDemo.zip( 2,599 k)