Created
September 27, 2015 22:59
-
-
Save albertoruvel/afbfa9b1df89b17f2def to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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