day2_1.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.0.xsd">

    <bean id="v1" class="day1.M4A4"></bean>
    <bean id="v2" class="day1.USP"/>
    <bean id="Girlfriend" class="day1.Person">
        <constructor-arg index="0" value="Your Girl Friend"/>
        <constructor-arg index="1" ref="v1"/>
        <constructor-arg index="2" ref="v2"/>
    </bean>

</beans>

main.java:

package day2;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class main {
    public static void main(String[] args) {
       ApplicationContext applicationContext = new ClassPathXmlApplicationContext("1.xml");
        Person girlFriend = applicationContext.getBean("Girlfriend", Person.class);
        System.out.println(girlFriend.isEmpty());
    }
}
Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'girlfriend' available
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:812)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1282)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1115)
	at day1.main.main(main.java:31)