test.java

来自「这是一款最新的野蔷薇论坛源码,有需要的朋友可以尽情下载」· Java 代码 · 共 42 行

JAVA
42
字号
/* 
 * Created on 2007-3-7
 * Last modified on 2007-3-7
 * Powered by YeQiangWei.com
 */
package com.yeqiangwei.club.service.proxy;

import com.yeqiangwei.club.service.ServiceLocator;
import com.yeqiangwei.club.service.model.UserModel;
import com.yeqiangwei.club.service.user.UserService;

public class Test {
	
	@SuppressWarnings("unchecked")
	public void test(){
		com.yeqiangwei.club.dao.hibernate.ConnectionManager.init();
		//UserService userService = ServiceWrapper.<UserService>getSingletonInstance(ServiceLocator.USER);
		//
		/*
		UserService userService = (UserService) ServiceWrapper.getSingletonInstance(ServiceLocator.USER);
		InvocationHandler handler = new Handler(userService); 
		UserService proxy = (UserService) Proxy.newProxyInstance(userService.getClass().getClassLoader()
				, userService.getClass().getInterfaces()
				, handler); 
				*/
		ProxyInterface<UserService> proxy = ProxyFactory.getProxyInstance();
		UserService userProxy = proxy.bind(ServiceLocator.USER);
		UserModel model = userProxy.findByUserName("222");
		//System.out.println(model);
		if(model!=null){
			//System.out.println(model.getUserId()+"//"+model.getUserName());
		}
		//System.out.println("userProxy.getMessage()"+userProxy.getMessage());
	}
	
	public static void main(String args[]){
		Test t = new Test();
		t.test();
	}
	
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?