zoukankan      html  css  js  c++  java
  • eclipse安装Spring的具体步骤

    1、下载spring 官网下载需要jar包放在lib中

    本人分享百度云jar

    链接:https://pan.baidu.com/s/1iEMwBbTTCxuCNOEdprlGhg
    提取码:e7tg
    2、 配置applicationContext.xml

    配置代码xml

    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd">
        <bean id="Student" class="entity.Student">
            <property name="name">
                <value>tom</value>
            </property>
        </bean>
    </beans>

    3、新建两个文件

    Student.java
    package entity;
    
    public class Student {
        
        private String name;
        
        public String getName() {
            return name;
        }
        
        public void setName(String name) {
            this.name = name;
        }
    
        
    }

    DemoTest.java

    package entity;
    
    import org.springframework.context.ApplicationContext;
    import org.springframework.context.support.ClassPathXmlApplicationContext;
    
    public class DemoTest {
    
        public static void main(String arg[]) {
            ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml"); // 实例化Spring容器
            Student stu = (Student) ctx.getBean("Student");
            System.out.println("name:" + stu.getName());
            System.out.println("test main");
        }
    }
  • 相关阅读:
    binutils工具集之---objcopy,ranlib,size,strings,strip
    FreeRtos——多任务
    IntelliJ Idea 常用快捷键
    了解Spring-boot-starter常用依赖模块
    Spring Boot项目的内嵌容器
    Spring Boot 简介
    webstorm的个性化设置settings
    webstorm使用心得
    webstorm快捷键
    WebStorm使用快速入门
  • 原文地址:https://www.cnblogs.com/guokefa/p/10275026.html
Copyright © 2011-2022 走看看