title: Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'std' defined in file
body: <pre><code>package com.nareshit.beans;
  
  public class Address {
      private String city,state;
      public String toString()
      {
      return "\n city:"+city+"\nstate:"+state;    
      }
      public String getCity() {
          return city;
      }
      public void setCity(String city) {
          this.city = city;
      }
      public String getState() {
          return state;
      }
      public void setState(String state) {
          this.state = state;
      }
  
  }
  
  package com.nareshit.clients;
  
  import java.awt.Container;
  import java.beans.Beans;
  
  import org.springframework.beans.factory.BeanFactory;
  import org.springframework.beans.factory.xml.XmlBeanFactory;
  import org.springframework.core.io.ClassPathResource;
  import org.springframework.core.io.FileSystemResource;
  import org.springframework.core.io.Resource;
  
  import com.nareshit.beans.Student;
  
  public class Test {
      public static void main(String[] args)
      {
          BeanFactory factory=new XmlBeanFactory(new ClassPathResource("MyBeans.xml"));
  
          Student std1=(Student)factory.getBean("std");
  
          std1.getStudentDetails();
      }
  }
  
  
  package com.nareshit.beans;
  
  public class Student {
      private int sid;
      private String name;
      private String address;
  
      public void getStudentDetails()
          {
          System.out.println("student id:"+sid);
          System.out.println("student name:"+name);
          System.out.println("student address:"+address);
          }
  
      public int getSid() {
          return sid;
      }
  
      public void setSid(int sid) {
          this.sid = sid;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getAddress() {
          return address;
      }
  
      public void setAddress(String address) {
          this.address = address;
      }
  
  }
  
      &lt;!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
                  "http://www.springframework.org/dtd/spring-beans-2.0.dtd"&gt;
      &lt;beans&gt;
      &lt;bean id="std" class="com.nareshit.beans.Student"&gt;
      &lt;property name="std" value="1001"/&gt;
      &lt;property name="name" value="mitu"/&gt;
      &lt;property name="address" ref="addressObj"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="addressObj" class="com.nareshit.beans.Address"&gt;
      &lt;property name="city" value="bam"/&gt;
      &lt;property name="state" value="odisha"/&gt;
      &lt;/bean&gt;
      &lt;/beans&gt;
  </code></pre>
  
  <p>This is the spring setter injection prog. where i am getting error:</p>
  
  <blockquote>
    <p>Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'std' defined in file("")</p>
  </blockquote>
  
  <p>how to solve it?</p>