zoukankan      html  css  js  c++  java
  • Spring阶段性学习总结(一)实现一个简单的HellowWorld

    记录一下自己Spring的学习历程

     1 package HelloWorld;
     2 
     3 public class HelloWorld {
     4 
     5     String name;
     6 
     7     public void setName(String name) {
     8         this.name = name;
     9     }
    10 
    11     public void hello() {
    12         System.out.println("helloWorld:" + name);
    13     }
    14 
    15     public HelloWorld() {
    16         System.out.println("我是构造方法!");
    17     }
    18 }
     1 package HelloWorld;
     2 
     3 import org.springframework.context.support.ClassPathXmlApplicationContext;
     4 
     5 public class Main {
     6     public static void main(String[] args) {
     7        
     8         ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("HelloWorld/applicationContext.xml");
     9         HelloWorld helloWorld = (HelloWorld) applicationContext.getBean("helloWorld");
    10         helloWorld.hello();
    11 
    12     }
    13 }
     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <beans xmlns="http://www.springframework.org/schema/beans"
     3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     4        xmlns:context="http://www.springframework.org/schema/context"
     5        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
     6 
     7     <bean id="helloWorld" class="HelloWorld.HelloWrold">
     8         <property name="name" value="张浩"></property>
     9     </bean>
    10 
    11 </beans>
  • 相关阅读:
    语言模型的压缩方法
    推荐算法之 Slope One 算法
    基于内容的推荐(Contentbased Recommendations)
    Txt文件转换为Excel文件
    WebResource 内嵌资源
    多层模态窗口showModalDialog页面提交及刷新
    屏蔽/自定义JavaScript脚本错误
    .net动态显示当前时间
    客户端自动累加
    中国IT管理之窥豹一斑
  • 原文地址:https://www.cnblogs.com/zhang188660586/p/11557037.html
Copyright © 2011-2022 走看看