• springbootHelloWorld


    //pom.xml

    <dependencies>
    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>5.1.7.RELEASE</version>
    </dependency>
    </dependencies>
    //Beans.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <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-3.0.xsd">

    <bean id="helloWorld" class="com.araxit.learn.HelloWorld">
    <property name="message" value="Hello World!"/>
    </bean>

    </beans>
    //HelloWorld
    package com.araxit.learn;

    public class HelloWorld {
    private String message;
    public void setMessage(String message){
    this.message = message;
    }
    public void getMessage(){
    System.out.println("Your Message : " + message);
    }

    }
    //Execute
    package com.araxit.learn;

    import org.springframework.beans.factory.xml.XmlBeanFactory;
    import org.springframework.core.io.ClassPathResource;

    public class Execute {
    public static void mian(String[] args){
    XmlBeanFactory factory = new XmlBeanFactory
    (new ClassPathResource("Beans.xml"));
    HelloWorld obj = (HelloWorld) factory.getBean("helloWorld");
    obj.getMessage();
    }
    }
  • 相关阅读:
    使用HTTP协下载文件
    DNS协议 实践
    操作系统学习笔记 线程
    操作系统学习笔记 进程
    操作系统学习笔记 操作系统概述
    操作系统学习笔记 栈
    操作系统学习笔记 概述
    C语言中的fread和fwrite
    【原】python-jenkins信息
    【转】通过python调用jenkins 常用api操作
  • 原文地址:https://www.cnblogs.com/simple-raxit/p/11319315.html
Copyright © 2020-2023  润新知