标签:pid ted ase utf-8 static cti text ram out
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 3 <modelVersion>4.0.0</modelVersion> 4 <groupId>com.ssm</groupId> 5 <artifactId>test</artifactId> 6 <packaging>war</packaging> 7 <version>0.0.1-SNAPSHOT</version> 8 <name>test Maven Webapp</name> 9 <url>http://maven.apache.org</url> 10 <dependencies> 11 <dependency> 12 <groupId>junit</groupId> 13 <artifactId>junit</artifactId> 14 <version>3.8.1</version> 15 <scope>test</scope> 16 </dependency> 17 <!-- https://mvnrepository.com/artifact/org.springframework/spring-core --> 18 <dependency> 19 <groupId>org.springframework</groupId> 20 <artifactId>spring-core</artifactId> 21 <version>5.0.4.RELEASE</version> 22 </dependency> 23 <!-- https://mvnrepository.com/artifact/org.springframework/spring-context --> 24 <dependency> 25 <groupId>org.springframework</groupId> 26 <artifactId>spring-context</artifactId> 27 <version>5.0.4.RELEASE</version> 28 </dependency> 29 <!-- https://mvnrepository.com/artifact/org.springframework/spring-expression --> 30 <dependency> 31 <groupId>org.springframework</groupId> 32 <artifactId>spring-expression</artifactId> 33 <version>5.0.4.RELEASE</version> 34 </dependency> 35 <!-- https://mvnrepository.com/artifact/org.springframework/spring-beans --> 36 <dependency> 37 <groupId>org.springframework</groupId> 38 <artifactId>spring-beans</artifactId> 39 <version>5.0.4.RELEASE</version> 40 </dependency> 41 42 </dependencies> 43 <build> 44 <finalName>test</finalName> 45 </build> 46 </project>
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 xsi:schemaLocation="http://www.springframework.org/schema/beans 5 http://www.springframework.org/schema/beans/spring-beans.xsd"> 6 <bean id="helloSpring" class="com.ssm.HelloSpring"> 7 <property name="userName" value="张三"> 8 9 </property> 10 </bean> 11 12 </beans>
1 package com.ssm; 2 3 public class HelloSpring { 4 private String userName; 5 public void setUserName(String userName) { 6 this.userName=userName; 7 } 8 public void show() { 9 System.out.println(userName + ":欢迎您来学习Spring 框架"); 10 } 11 }
1 package com.ssm; 2 import org.springframework.context.ApplicationContext; 3 import org.springframework.context.support.ClassPathXmlApplicationContext; 4 public class TestHelloSpring { 5 6 public static void main(String[] args) { 7 // TODO Auto-generated method stub 8 ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml"); 9 HelloSpring helloSpring =(HelloSpring)ctx.getBean("helloSpring"); 10 helloSpring.show(); 11 } 12 13 }
标签:pid ted ase utf-8 static cti text ram out
原文地址:https://www.cnblogs.com/yyyyfly1/p/12227389.html