---
title: S端开发
description: "如下所示，对于S端开发，需要使用两个注解@HafService和@HafServerMain。其中，注解@HafService是加在静态函数上面，表示函数将提供主机节点应用远端调用，注解@HafServerMain加在main方法上面，表示这是项目的主函数入口。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2200SPC5/accel/kunpengaccel_haf_06_0053.html
sourcePath: /source/zh/kunpengboostkithistory/2200SPC5/accel/kunpengaccel_haf_06_0053.html
indexId: eb2abe12622d71cecb9a870275a1e2e59fe0159617486a52574c7af8607979b578
---
# S端开发

如下所示，对于S端开发，需要使用两个注解@HafService和@HafServerMain。其中，注解@HafService是加在静态函数上面，表示函数将提供主机节点应用远端调用，注解@HafServerMain加在main方法上面，表示这是项目的主函数入口。
```
public class TestMain {
@HafService
public static int testService(int a, int b) {
System.out.println("call add");
return a + b;
}
@HafServerMain
public static void main(String[] args) {
System.out.println("main start");
}
}
```


- S端的项目代码中，必须使用注解@HafServerMain指定一个函数为主函数，建议添加在主函数main中。
- 使用注解@HafService指定提供服务的函数，必须是静态公开方法。
