Skip to content

Instantly share code, notes, and snippets.

@albertoruvel
Created September 27, 2015 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save albertoruvel/afbfa9b1df89b17f2def to your computer and use it in GitHub Desktop.
Save albertoruvel/afbfa9b1df89b17f2def to your computer and use it in GitHub Desktop.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.springip.server;
import com.springip.client.PersonGateway;
import com.springip.server.model.Person;
import com.springip.server.model.Result;
import org.springframework.context.support.GenericXmlApplicationContext;
/**
*
* @author Alberto
*/
public class Test {
public static void main(String[] args) {
System.out.println("Getting context");
GenericXmlApplicationContext context = Test.setupContext();
System.out.println("Context created");
System.out.println("Getting persons gateway");
PersonGateway gateway = context.getBean(PersonGateway.class);
System.out.println("Creating a new Person");
Person person = new Person();
person.setName("Alberto Rubalcaba");
person.setAge(24);
System.out.println("Sending person through gateway");
Result result = gateway.sendPerson(person);
System.out.println("Connection result: " + result.getStatus());
}
public static GenericXmlApplicationContext setupContext() {
final GenericXmlApplicationContext context = new GenericXmlApplicationContext();
context.load("classpath:context.xml");
context.registerShutdownHook();
context.refresh();
return context;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment