发表于: 2020-01-09 19:59:30
1 1249
一、今天完成的事
1.配置好多个中央仓库导包的问题
在properties标签下复制
<profile>
<id>myRepositories1</id>
<repositories>
<repository>
<id>nexus-ptteng</id>
<name>ptteng</name>
<url>http://nexusNaNteng.com/nexus/content/repositories/releases/</url>
</repository>
</repositories>
</profile>
<profile>
<id>myRepositories2</id>
<repositories>
<repository>
<id>nexus-aliyun</id>
<name>aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</repository>
</repositories>
</profile>
然后到最后一行中的activeProperties标签中指定properties中的id
<activeProfiles>
<activeProfile>myRepositories1</activeProfile>
<activeProfile>myRepositories2</activeProfile>
</activeProfiles>
2.修改配置文件
项目结构如下
在video_dao.xml中编写sql语句
<object name="com.jnshu.model.Video"
listenerClass="" strategyProperty="">
<list name="getVideoTitleById"
sqlitem="select id from video where status=? order by update_at desc"
keyProperty="status" valueProperty="id" keyColumn="status"/>
</object>
在application.xml中加入sca和bean
<sca:service name="videoService"
type="com.jnshu.service.VideoService"
target="videoService"/>
<bean id="videoService"
class="com.jnshu.service.serviceImpl.VideoServiceImpl"
parent="baseDaoService">
</bean>
<bean id="dao" class="com.gemantic.dal.dao.impl.CompositeDaoImpl"/>
<bean id="baseDaoService"
class="comNaNteng.common.dao.BaseDaoServiceImpl">
<property name="dao" ref="dao"/>
</bean>
core中加入service
@Remotable
public interface VideoService extends BaseDaoService {
public List<Video> gertVideoListByIds(List<Long> ids) throws ServiceException,ServiceDaoException;
public boolean delete(Long id) throws ServiceException, ServiceDaoException;
public boolean insert() throws ServiceException,ServiceDaoException;
public boolean update() throws ServiceException,ServiceDaoException;
public Video getVideoById() throws ServiceException,ServiceDaoException;
}
然后加入Tuscany框架的client,继承封装的BaseDaoService
@Remotable
public interface VideoService extends BaseDaoService {
public List<Video> gertVideoListByIds(List<Long> ids) throws ServiceException,ServiceDaoException;
public boolean delete(Long id) throws ServiceException, ServiceDaoException;
public boolean insert() throws ServiceException,ServiceDaoException;
public boolean update() throws ServiceException,ServiceDaoException;
public Video getVideoById() throws ServiceException,ServiceDaoException;
}
server中引入自定义的core包
实现类写在sever中
添加server.properties配置文件
<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
xmlns:scallop="http://scallop/xmlns/sca/1.0" xmlns:aop="http://www.springframework.org/schema/aop"
targetNamespace="http://FansAdminComponent" xmlns:sample="http://FansAdminComponent"
name="FansAdminComponent">
<component name="DalAdminService">
<implementation.spring location="META-INF/applicationContext-server.xml"/>
</component>
<service name="videoService" promote="DalAdminService/VideoService">
<interface.java interface="com.jnshu.service.VideoService"/>
<scallop:binding.rmi host="localhost" port="11551" serviceName="VideoRMIService"/>
</service>
</composite>
最后添加公司内部注册中心Scallop
scallop.registry.center = http://scallop.resource.center:8102
scallop.performace.rmi.processTimeThreshold=200
scallop.performace.rmi.showParameters=false
scallop.performace.rmi.executeTimesPrintInterval=600
controller中直接调用服务
二、遇到的问题
三、收获
四、明天的计划
继续dal
评论