Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions sofarpc-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>sofarpc-sample</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>


</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="mailto:[email protected]">leizhiyuan</a>
*/
@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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
*/
public interface AnnotationService {

String sayAnnotation(String stirng);
String sayAnnotation(String string);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href="mailto:[email protected]">leizhiyuan</a>
*/
@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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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);

Expand Down