📄 testsimpleaction.java
字号:
/*
* $Workfile: TestSimpleAction.java$
* Copyright (c) 2005 Freeborders.
* All rights reserved.
*
* Last Changed by: $Author:user$
* On: $Date: 2005-6-3 16:27:18$
* $Revision: 1$
*/
package test;
import java.util.Calendar;
import java.util.Locale;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.core.io.Resource;
import base.AOPInstrumenter;
import base.AOPOjbect;
import base.Action;
import base.LoginAction;
/**
* Class description goes here.
* @version 1.0 2005-6-3
* @author user
*/
public class TestSimpleAction
{
public static void main(String[] args)
{
//new TestSimpleAction().testAction();
//new TestSimpleAction().testMessage();
//new TestSimpleAction().testResource();
//new TestSimpleAction().testEvent();
AOPInstrumenter aopInst = new AOPInstrumenter();
AOPOjbect AOPObj =(AOPOjbect) aopInst.getInstrumentedClass(AOPOjbect.class);
String obj=AOPObj.test("sunpeng");
System.out.println("==============="+obj);
}
public void testAction()
{
ApplicationContext ctx=new FileSystemXmlApplicationContext("bean.xml");
Action action = (Action) ctx.getBean("TheAction");
System.out.println(action.excute("Rod Johnson"));
}
public void testMessage()
{
ApplicationContext ctx=new FileSystemXmlApplicationContext("resourceBean.xml");
Object[] arg = new Object[]{"test",Calendar.getInstance().getTime()};
String msg = ctx.getMessage("userinfo", arg,Locale.getDefault());
System.out.println("Message is ===> "+msg);
}
public void testResource()
{
ApplicationContext ctx=new FileSystemXmlApplicationContext("resourceBean.xml");
Resource rs = ctx.getResource("/messages_zh_CN.properties");
if(rs.exists())
{
System.out.println("资源存在");
}
else
{
System.out.println("资源不存在");
}
}
public void testEvent()
{
ApplicationContext ctx=new
FileSystemXmlApplicationContext("resourceBean.xml");
LoginAction action = (LoginAction)ctx.getBean("loginaction");
action.login("孙鹏","mypass");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -