package br.org.senacagil.hello.client;

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

import br.org.senacagil.hello.bean.HelloBean;
import br.org.senacagil.hello.domain.Name;

public class TestClient {
	public static void main(String[] args) {
		try {
			System.out.println("TestClient started");

			// Load the hello.xml to classpath
	    	ApplicationContext ac = new ClassPathXmlApplicationContext(
					"classpath:hello.xml");

			System.out.println("Classpath loaded !");

			HelloBean helloBean = (HelloBean)ac.getBean("helloBean");

			Name name = new Name();
			name.setFirstName("Tony");
			name.setLastName("Greg");
			
			String str = helloBean.wishMe(name);
			System.out.println(str);
						
			System.out.println("TestClient end !");

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
