配置:
<?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:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> <bean id="dataSourceManager" class="com.ursful.framework.orm.DataSourceManager"> <property name="dataSource" ref="dataSource"/> </bean> </beans> |
用法,实体类略:
接口:
import com.ursful.framework.orm.IBaseService; import com.ursful.framework.admin.common.entity.SysRole; public interface ISysRoleService extends IBaseService<SysRole>{ } |
实现类:
import com.ursful.framework.orm.BaseServiceImpl; import org.springframework.stereotype.Service; import com.ursful.framework.admin.common.entity.SysRole; import com.ursful.framework.admin.common.service.ISysRoleService; @Service("sysRoleService") public class SysRoleServiceImpl extends BaseServiceImpl<SysRole> implements ISysRoleService{ } |
控制类注入即可:
@Autowired private ISysRoleService sysRoleService; |