公共接口SMS服務{
public boolean send SMS(String SMS id,String number,String msg);
}
假設是這樣實現的:
公共類TestService實現SmsService{
public boolean sendSMS(String SMS id,String number,String msg){
System.out.println("收件人:"+數字);
System.out.println("測試消息:"+msg);
返回true
}
}
然後生態系統會在發送短信時調用TestService中的sendSMS方法。
2.將上述實現部署到生態學中。只需修改sms.xml,或者以上面的實現為例:
& lt模塊id="sms "版本="1.0.0 " >
& lt服務點id = " SMS sender " interface = " weaver . SMS . SMS service " & gt;
& ltinvoke-factory & gt;
& ltconstruct class="TestService " >
& lt/construct & gt;
& lt/invoke-factory & gt;
& lt/服務點& gt
& lt/module & gt;