一個完整項目:
產品:需求文檔,數據庫設計文檔,接口文檔,用戶使用手冊
項目: 后台管理系統,后台接口,前端頁面
測試
Java后台接口:強調前端與后台之間的連接接口,通過接口文檔來統一規定,不同於接口定義
接口文檔:設定統一格式規定前端與后台編寫接口和請求接口的規范
后台需按照文檔規范編寫接口代碼方便用於接口測試和前端請求接口,當用戶需求改變時,只需具體改動某個版塊
引申出的問題:當一個接口有多個實現類的時候,如何確定調用哪一個
控制層:@Controller
public class FileController{
第一個實例service引用
@Autowired
@Qualifier("PersonService")
private PeopService PersonService;
第二個實例service引用
@Autowired
@Qualifier("EnterService")
private PeopleService EnterService;
第一個service調用
@RequestMapping("/Person")
@ResponseBody
public String PersonFile()
{
PersonService.File();
return "PernsonInfoFile";
}
第二個service調用
@RequestMapping("/Enter")
@ResponseBody
public String EnterpriseInfoExcelFile()
{
EnterpriseInfoFileService.File();
return "EnterpriseInfoFile";
}
}
service實現層:@Service("PersonService")
public class PersonServiceImpl implements PeopleService
{
public boolean File()
{
System.out.println("Person");
return false;
}
}
第二個service實現層
@Service("EnterService")
public class EnterServiceImpl implements PeopleService
{
public boolean File()
{
System.out.println("Enter");
return false;
}
}
