diff --git a/sofarpc-sample/pom.xml b/sofarpc-sample/pom.xml index 9efb390..5a68b29 100644 --- a/sofarpc-sample/pom.xml +++ b/sofarpc-sample/pom.xml @@ -10,6 +10,18 @@ 4.0.0 sofarpc-sample + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + \ No newline at end of file diff --git a/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnnotationClientImpl.java b/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnnotationClientImpl.java index b6973f7..a84bed4 100644 --- a/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnnotationClientImpl.java +++ b/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnnotationClientImpl.java @@ -18,21 +18,19 @@ import com.alipay.sofa.runtime.api.annotation.SofaReference; import com.alipay.sofa.runtime.api.annotation.SofaReferenceBinding; -import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; /** * @author leizhiyuan */ -@Component +@Service public class AnnotationClientImpl { - @SofaReference(interfaceType = AnnotationService.class, jvmFirst = false, binding = @SofaReferenceBinding(bindingType = "bolt")) + @SofaReference(interfaceType = AnnotationService.class, jvmFirst = false, + binding = @SofaReferenceBinding(bindingType = "bolt")) private AnnotationService annotationService; public String sayClientAnnotation(String str) { - - String result = annotationService.sayAnnotation(str); - - return result; + return annotationService.sayAnnotation(str); } } \ No newline at end of file diff --git a/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnnotationService.java b/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnnotationService.java index 7ed5061..983e8c9 100644 --- a/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnnotationService.java +++ b/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnnotationService.java @@ -22,6 +22,6 @@ */ public interface AnnotationService { - String sayAnnotation(String stirng); + String sayAnnotation(String string); } \ No newline at end of file diff --git a/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnnotationServiceImpl.java b/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnnotationServiceImpl.java index d82ab22..317cdaa 100644 --- a/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnnotationServiceImpl.java +++ b/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnnotationServiceImpl.java @@ -18,16 +18,16 @@ import com.alipay.sofa.runtime.api.annotation.SofaService; import com.alipay.sofa.runtime.api.annotation.SofaServiceBinding; -import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; /** * @author leizhiyuan */ @SofaService(interfaceType = AnnotationService.class, bindings = { @SofaServiceBinding(bindingType = "bolt") }) -@Component +@Service public class AnnotationServiceImpl implements AnnotationService { @Override - public String sayAnnotation(String stirng) { - return stirng; + public String sayAnnotation(String string) { + return string; } } \ No newline at end of file diff --git a/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnotationClientApplication.java b/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnotationClientApplication.java index 6fbd5f9..14e3025 100644 --- a/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnotationClientApplication.java +++ b/sofarpc-sample/src/main/java/com/alipay/sofa/rpc/samples/annotation/AnotationClientApplication.java @@ -27,7 +27,6 @@ public class AnotationClientApplication { public static void main(String[] args) { - //change port to run in local machine System.setProperty("server.port", "8081"); @@ -38,7 +37,6 @@ public static void main(String[] args) { AnnotationClientImpl annotationService = applicationContext .getBean(AnnotationClientImpl.class); - String result = annotationService.sayClientAnnotation("annotation"); System.out.println("invoke result:" + result);