private void recvBean(Source source) throws Exception {
   System.out.println("**** recvBean ******");
   JAXBElement element = (JAXBElement) jaxbContext.createUnmarshaller().unmarshal(source);
   System.out.println("name=" + element.getName() + " value=" + element.getValue());
   if (element.getValue() instanceof SayHello) {
     SayHello hello = (SayHello) element.getValue();
     System.out.println("Say Hello from " + hello.getArg0());
   }
 }
Example #2
0
  public static void main(String[] args) {

    ApplicationContext context = new ClassPathXmlApplicationContext("application-context.xml");

    SayHello hello = (SayHello) context.getBean("hello");
    hello.greet();
    for (int i = 0; i < 10; i++) {
      hello.addUser();
    }
    hello.printUsers();
  }
 public String say() {
   return prefix + sayHello.say();
 }