zoukankan      html  css  js  c++  java
  • SSH环境搭建,配置整合初步(一)

    1,新Webproject。并把编码设为utf-8(全部的都是uft8数据库也是,就不会乱码了)
    2。加入框架环境
    Junit
    Struts2
    Hibernate 
    Spring
    3,整合SSH
    Struts2与Spring整合
    Hibernate与Spring整合
    4。资源分类
    5,配置日志




    Struts2
    jar包
    struts.xml, web.xml
    Hibernate
    jar包:核心包, 必须包, jpa, c3p0, jdbc
    hibernate.cfg.xml, *.hbm.xml
    Spring
    jar包
    appicationContext.xml/beans.xml




    声明一个bean

    (在bean/xml文件加入 

    <!-- 自己主动扫描与装配bean -->

    <context:component-scan base-package="你的包名"></context:component-scan>)


    @Component("beanName")
    @Controller
    @Service
    @Repository


    配置bean的scope
    @Scope("prototype")


    注入bean
    @Resource




    Spring与Struts2整合
    1,在web.xml中配置Spring的监听器
    2,加一个jar包


    Hibernate与Spring整合
    1。管理SessionFactory实例(仅仅须要一个)
    2,声明式事务管理




    Spring
    IOC 管理对象..
    AOP 事务管理..




    代码:
    boolean needLog = ConfigFile.getBooleanValue("needLog");


    if( needLog ){
    System.out.println("xxx");  // System.err.println("");
    }


    配置文件(mylog.properties)
    needLog = true/false




    slf4j
    JDK logging --> logging.properties
    Log4j       --> log4j.properties
    ...




    debug 调试信息
    info 一般信息
    warn 警告
    error 错误

    fatal 严重错误




    ================================================ 基本功能






    User, UserDao
    save(User user), update(), delete(), find(), ...
    Role, RoleDao
    save(Role role), update(), delete(), find(), ...
    Student, StudentDao
    save(Student student), update(), delete(), find(), ...
    ...




    BaseDao<T>
    save(T t), update(), delete(), find()


    UserDao extends BaseDao<User> { ... }
    RoleDao extends BaseDao<Role>{ ... }
    ...


  • 相关阅读:
    分析记录:文件不落地的恶意脚本攻击——傀儡进程盗号
    恶意宏学习备忘04——恶意宏调试记录
    恶意宏学习备忘03——手动清除文档宏
    恶意宏学习备忘02
    恶意宏学习备忘
    IRP小结 0x01 IRP & IO_STACK_LOCATION(结合WRK理解)
    文件防删除保护(miniifiter)
    初识虚拟化
    HYPERSPACE
    几个常用内核函数(《Windows内核情景分析》)
  • 原文地址:https://www.cnblogs.com/mqxnongmin/p/10704056.html
Copyright © 2011-2022 走看看