本指南將引導您瞭解Leopard開發約定。java
你能夠從頭開始並完成每個步驟,或者您能夠繞過你已經熟悉的基本設置步驟。不管哪一種方式,你最終均可以獲得可工做的代碼。mysql
src/main/java/${groupId}/dao
DAO接口,如UserDao.java src/main/java/${groupId}/dao/mysql
DAO MySQL實現類,如UserDaoMysqlImpl.java src/main/java/${groupId}/dao/redis
DAO Redis實現類,如UserDaoRedisImpl.java src/main/java/${groupId}/dao/cache
DAO 緩存控制實現類,如UserDaoCacheImpl.java src/main/java/${groupId}/service
Service接口,如UserService.java src/main/java/${groupId}/service/impl
Service實現類,如UserServiceImpl.javaredis
src/main/resources/applicationContext.xml
#Spring配置入口文件 src/main/resources/app.properties
#資源文件(生產環境),可選 src/main/resources/dev/app.properties
#測試環境資源文件,可選spring
Leopard團隊建議使用註解結合Leopard標籤註冊Spring Bean,能夠很大程度精簡配置.sql
全部Spring Bean只需增長@Component
,或使用更加細的註解@Controller
、@Service
、@Repository
.緩存
src/main/resources/applicationContext.xml
app
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:leopard="http://www.leopard.io/schema/leopard" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.leopard.io/schema/leopard http://www.leopard.io/schema/leopard.xsd"> <leopard:component-scan base-package="{basePackage}" /> </beans>
恭喜你!您已經學會Leopard開發約定,祝您好運.ide