zoukankan      html  css  js  c++  java
  • Spring安装与入门

    1. Spring组成

     

    • Inversion of Control (IoC)
    • Aspect Oriented Programming (AOP)
    • Abstract Service

    2. Spring下载

    http://www.springsource.com/download/community?sid=1212680

    3. Spring实例

    EricTest.java

    package erictest;

    import org.springframework.context.ApplicationContext;
    import org.springframework.context.support.FileSystemXmlApplicationContext;

    public class EricTest {
        public static void main(String argv[]) {
            ApplicationContext ctx = new FileSystemXmlApplicationContext("src/ericspring.xml");
            ShowMessage sm = (ShowMessage)ctx.getBean("ericBean");
            sm.show();
        }
    }



    ShowMessage.java

    package erictest;

    public class ShowMessage {

        private String message;

        public void setMessage(String message){
               this.message = message;
        }
       
        public String getMessage(){
               return this.message;
        }

        public void show(){
               System.out.print("Spring Test Message: " + getMessage());
        }
    }

     

    ericspring.xml

    package erictest;

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
        <bean id = "ericBean" class="erictest.ShowMessage">
           <property name="message">
               <value>Says Hello Spring!</value>
           </property>
        </bean>
    </beans>


    运行即可显示结果

    Spring Test Message: Says Hello Spring!

  • 相关阅读:
    jQuery工具函数
    jqXHR对象
    跨域获取
    Ajax :六个全局事件
    表单序列化
    Ajax : $. get()和$.post() $.getScript $.getJSON
    Ajax : load()
    列队动画
    关于MindManager显示不同级别的控制
    Mybatis 查询传多个参数(3中方法)
  • 原文地址:https://www.cnblogs.com/ericsun/p/2103502.html
Copyright © 2011-2022 走看看