zoukankan      html  css  js  c++  java
  • Maven SSH三大框架整合的加载流程

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

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

    day02视频4ssh整合-struts2跟spring框架整合.avi;
    day02视频4ssh整合-分别搭建环境.avi;
    day02视频6ssh整合-spring跟Hibernate框架整合.avi;
    day02视频7ssh整合功能案例实现.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");
    }
  • 相关阅读:
    Vue 介绍
    Django 组件-分页器
    Django 组件content_type
    DRF 解析器组件
    Django
    Django 组件-ModelForm
    Django 组件-用户认证
    Django 组件-中间件
    Django 组件-cookie与session
    Django CBV与FBV
  • 原文地址:https://www.cnblogs.com/rogge7/p/7275163.html
Copyright © 2011-2022 走看看