From 49a28fd5795d7ed1d155a2ee571a98e009214281 Mon Sep 17 00:00:00 2001 From: rfeng Date: Thu, 29 Jul 2010 00:14:45 +0000 Subject: Add the parent delegation for the SCA spring application context Improve the sample to demonstrate the child bean wired to a bean in the parent context (WebApplicationContext) git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@980272 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/sample/DateServiceImpl.java | 1 + .../src/main/java/sample/HelloworldImpl.java | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'sca-java-2.x/trunk/samples/helloworld-spring/src/main/java') diff --git a/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/DateServiceImpl.java b/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/DateServiceImpl.java index 2b3c412de3..64bdd86f7c 100644 --- a/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/DateServiceImpl.java +++ b/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/DateServiceImpl.java @@ -30,6 +30,7 @@ import org.oasisopen.sca.annotation.Service; public class DateServiceImpl implements DateService { public Date getDate() { + System.out.println("DateServiceImpl.getDate()"); return new Date(); } diff --git a/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/HelloworldImpl.java b/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/HelloworldImpl.java index a44dcacc3a..125c333ddc 100644 --- a/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/HelloworldImpl.java +++ b/sca-java-2.x/trunk/samples/helloworld-spring/src/main/java/sample/HelloworldImpl.java @@ -18,17 +18,17 @@ */ package sample; -import org.oasisopen.sca.annotation.Reference; public class HelloworldImpl implements Helloworld { - @Reference(required = false) - private DateService dateService; + + public HelloworldImpl() { + super(); + System.out.println("HelloworldImpl()"); + } public String sayHello(String name) { - if (dateService == null) { - return "Hello " + name; - } - return "[" + dateService.getDate() + "] Hello " + name; + System.out.println("HelloworldImpl.sayHello(" + name + ")"); + return "Hello " + name; } } -- cgit v1.2.3