Maven SSH三大框架整合的加载流程

《Maven精品教程视频\day02视频\03ssh配置文件加载过程.avi;》

此课程中讲 SSH三大框架整合的加载流程,还可以,初步接触的朋友可以听一听。

\day02视频\04ssh整合-struts2跟spring框架整合.avi;
\day02视频\04ssh整合-分别搭建环境.avi;
\day02视频\06ssh整合-spring跟Hibernate框架整合.avi;
\day02视频\07ssh整合功能案例实现.avi;

》 这几节课都可以听,可以快速了解一下 shh的搭建。

 

 

-------------测试 每个模块都测试

DAO模块中 也可以写测试,选中某个单元文件,右键创建 Junit测试单元,选择放在 test 目录  下面是注解方式

有必要重复听,看看Test中是如何实现 自动注入对象的,之前本人测试时碰到不可以注入。

import static org.junit.Assert.*;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:spring/applicationContext-*.xml")
public class CustomerDaoTest {
    
    @Autowired
    private CustomerDao dao;

    @Test
    public void testFindOne() {
        dao.findOne("1");
    }

 

在service 模块写测试??  可以写。  下面是手动加载bean方式。

classpath*:spring/applicationContext-*.xml  第一个*指加载不仅仅当前 classpath(可以其他模块jar包的classpath), 第二*通配符。
@Test
public void testFindOne() {
ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext("classpath*:spring/applicationContext-*.xml");
CustomerService service = (CustomerService) classPathXmlApplicationContext.getBean("customerService");
service.findOne("1");
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值