}
public void setMessage(String string) {
message = string;
public String execute(String str) {
return (getMessage() + str).toUpperCase();
配置文件bean.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<description>Spring Quick Start</description>
<bean id="TheAction" class="beantest.LowerAction">
<property name="message">
<value>HeLLo </value>
</property>
</bean>
</beans>
使用 ApplicationContext 来操作他们。
public static void main(String[] args)
{
System.out.println("Hello!");
try
ApplicationContext ctx = new FileSystemXmlApplicationContext("bean.xml");
Action action = (Action) ctx.getBean("TheAction");
System.out.println(action.execute("Rod Johnson"));
catch(Exception e)
上一页 [1] [2] [3] [4] 下一页
Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved. 闵涛 E_mail:admin@mintao.net(欢迎提供学习资源)
鄂公网安备 42011102001154号
站长:MinTao ICP备案号:鄂ICP备11006601号-18