📄 test.java
字号:
/*
* 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -