当前位置: 首页>>代码示例>>Java>>正文


Java ProxyFactoryBean.setTarget方法代码示例

本文整理汇总了Java中org.springframework.aop.framework.ProxyFactoryBean.setTarget方法的典型用法代码示例。如果您正苦于以下问题:Java ProxyFactoryBean.setTarget方法的具体用法?Java ProxyFactoryBean.setTarget怎么用?Java ProxyFactoryBean.setTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.aop.framework.ProxyFactoryBean的用法示例。


在下文中一共展示了ProxyFactoryBean.setTarget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: upgradeAllOrNothing

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
@Test
@DirtiesContext
public void upgradeAllOrNothing() throws Exception {
	TestUserService testUserService = new TestUserService(users.get(3).getId());
	testUserService.setUserDao(this.userDao);
	testUserService.setMailSender(mailSender);
	
	ProxyFactoryBean txProxyFactoryBean = context.getBean("&userService", ProxyFactoryBean.class);
	txProxyFactoryBean.setTarget(testUserService);
	
	UserService txUserService = (UserService) txProxyFactoryBean.getObject();

	userDao.deleteAll();

	for (User user : users)
		userDao.add(user);

	try {
		txUserService.upgradeLevels();
		fail("TestUserServiceException expected");
	} catch (TestUserServiceException e) {
	}
	checkLevel(users.get(1), false); // 오류 이전에 Update 한 사용자의 Level이 바뀌었나 확인
}
 
开发者ID:UCJung,项目名称:javalab,代码行数:25,代码来源:UserServiceTest.java

示例2: proxyFactoryBean

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
@Test
public void proxyFactoryBean() {
	ProxyFactoryBean pfBean = new ProxyFactoryBean();
	pfBean.setTarget(new HelloTarget());
	pfBean.addAdvice(new UppercaseAdvice());
	pfBean.setInterfaces(new Class[] { Hello.class }); // 생략해도 됨.

	Hello proxiedHandler = (Hello) pfBean.getObject();

	assertThat(proxiedHandler.sayHello("JUNG"), is("HELLO JUNG"));
	assertThat(proxiedHandler.sayHi("JUNG"), is("HI JUNG"));
	assertThat(proxiedHandler.sayThankYou("JUNG"), is("THANK YOU JUNG"));
}
 
开发者ID:UCJung,项目名称:javalab,代码行数:14,代码来源:HelloTest.java

示例3: pointcutAdvisor

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
@Test
public void pointcutAdvisor() {
	ProxyFactoryBean pfBean = new ProxyFactoryBean();
	pfBean.setTarget(new HelloTarget());

	NameMatchMethodPointcut pointcut = new NameMatchMethodPointcut();
	pointcut.setMappedName("sayH*");

	pfBean.addAdvisor(new DefaultPointcutAdvisor(pointcut,
			new UppercaseAdvice()));

	Hello proxiedHello = (Hello) pfBean.getObject();

	assertThat(proxiedHello.sayHello("Jung"), is("HELLO JUNG"));
	assertThat(proxiedHello.sayHi("Jung"), is("HI JUNG"));
	assertThat(proxiedHello.sayThankYou("Jung"), is("Thank you Jung"));
}
 
开发者ID:UCJung,项目名称:javalab,代码行数:18,代码来源:HelloTest.java

示例4: checkAdvice

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
private void checkAdvice(Object target,
		Pointcut pointcut, boolean adviced) {
	ProxyFactoryBean pfBean = new ProxyFactoryBean();
	pfBean.setTarget(target);
	pfBean.addAdvisor(new DefaultPointcutAdvisor(pointcut, new UppercaseAdvice()));
	Hello proxiedHello = (Hello)pfBean.getObject();
	
	if (adviced) {
		assertThat(proxiedHello.sayHello("Jung"), is("HELLO JUNG"));
		assertThat(proxiedHello.sayHi("Jung"), is("HI JUNG"));
		assertThat(proxiedHello.sayThankYou("Jung"), is("Thank you Jung"));			
	}
	else {
		assertThat(proxiedHello.sayHello("Jung"), is("Hello Jung"));
		assertThat(proxiedHello.sayHi("Jung"), is("Hi Jung"));
		assertThat(proxiedHello.sayThankYou("Jung"), is("Thank you Jung"));			
	}
}
 
开发者ID:UCJung,项目名称:javalab,代码行数:19,代码来源:HelloTest.java

示例5: createProxyFactoryBean

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
private ProxyFactoryBean createProxyFactoryBean(IService rawService, boolean proxyTargetClass) throws ClassNotFoundException {
	final ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
	proxyFactoryBean.setProxyInterfaces(new Class<?>[]{IService.class});
	proxyFactoryBean.setTarget(rawService);
	proxyFactoryBean.setProxyTargetClass(proxyTargetClass);
	return proxyFactoryBean;
}
 
开发者ID:pchudzik,项目名称:springmock,代码行数:8,代码来源:ToSpyReplacingProcessorTest.java

示例6: proxyAdvice

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
private static <T> T proxyAdvice(T t, Advice methodInterceptor) {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
    proxyFactoryBean.setTargetClass(t.getClass());
    proxyFactoryBean.setTarget(t);
    proxyFactoryBean.addAdvice(methodInterceptor);
    return (T) proxyFactoryBean.getObject();
}
 
开发者ID:maniaclee,项目名称:shardy,代码行数:8,代码来源:ShardSqlSessionFactoryBean.java

示例7: proxyAdvice

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
public static <T> T proxyAdvice(T t, Advice methodInterceptor) {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
    proxyFactoryBean.setTargetClass(t.getClass());
    proxyFactoryBean.setTarget(t);
    proxyFactoryBean.addAdvice(methodInterceptor);
    return (T) proxyFactoryBean.getObject();
}
 
开发者ID:maniaclee,项目名称:shardy,代码行数:8,代码来源:ProxyUtils.java

示例8: amazonDynamoDbProxy

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
@Bean(name = "amazonDynamoDB")
public ProxyFactoryBean amazonDynamoDbProxy() {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();

    proxyFactoryBean.setTarget(amazonDynamoDB());
    proxyFactoryBean.setInterceptorNames("retryInterceptor");
    return proxyFactoryBean;
}
 
开发者ID:SungardAS,项目名称:enhanced-snapshots,代码行数:9,代码来源:AmazonConfigProvider.java

示例9: amazonEC2Proxy

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
@Bean
public ProxyFactoryBean amazonEC2Proxy() {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();

    proxyFactoryBean.setTarget(amazonEC2());
    proxyFactoryBean.setInterceptorNames("retryInterceptor");

    return proxyFactoryBean;
}
 
开发者ID:SungardAS,项目名称:enhanced-snapshots,代码行数:10,代码来源:AmazonConfigProvider.java

示例10: amazonS3Proxy

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
@Bean
public ProxyFactoryBean amazonS3Proxy() {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();

    proxyFactoryBean.setTarget(amazonS3());
    proxyFactoryBean.setInterceptorNames("retryInterceptor");

    return proxyFactoryBean;
}
 
开发者ID:SungardAS,项目名称:enhanced-snapshots,代码行数:10,代码来源:AmazonConfigProvider.java

示例11: amazonDynamoDbMapperProxy

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
@Bean (name = "amazonDynamoDbMapper")
public ProxyFactoryBean amazonDynamoDbMapperProxy() {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();

    proxyFactoryBean.setTarget(dynamoDBMapper());
    proxyFactoryBean.setInterceptorNames("retryInterceptor");

    return proxyFactoryBean;
}
 
开发者ID:SungardAS,项目名称:enhanced-snapshots,代码行数:10,代码来源:AmazonConfigProvider.java

示例12: amazonAutoScalingProxy

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
@Bean
public ProxyFactoryBean amazonAutoScalingProxy() {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
    proxyFactoryBean.setTarget(autoScalingClient());
    proxyFactoryBean.setInterceptorNames("retryInterceptor");
    return proxyFactoryBean;
}
 
开发者ID:SungardAS,项目名称:enhanced-snapshots,代码行数:8,代码来源:AmazonConfigProvider.java

示例13: amazonELBProxy

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
@Bean
public ProxyFactoryBean amazonELBProxy() {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
    proxyFactoryBean.setTarget(elasticLoadBalancingClient());
    proxyFactoryBean.setInterceptorNames("retryInterceptor");
    return proxyFactoryBean;
}
 
开发者ID:SungardAS,项目名称:enhanced-snapshots,代码行数:8,代码来源:AmazonConfigProvider.java

示例14: amazonCloudWatch

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
@Bean
public ProxyFactoryBean amazonCloudWatch() {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
    proxyFactoryBean.setTarget(cloudWatchClient());
    proxyFactoryBean.setInterceptorNames("retryInterceptor");
    return proxyFactoryBean;
}
 
开发者ID:SungardAS,项目名称:enhanced-snapshots,代码行数:8,代码来源:AmazonConfigProvider.java

示例15: amazonSNS

import org.springframework.aop.framework.ProxyFactoryBean; //导入方法依赖的package包/类
@Bean
public ProxyFactoryBean amazonSNS() {
    ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean();
    proxyFactoryBean.setTarget(amazonSNSClient());
    proxyFactoryBean.setInterceptorNames("retryInterceptor");
    return proxyFactoryBean;
}
 
开发者ID:SungardAS,项目名称:enhanced-snapshots,代码行数:8,代码来源:AmazonConfigProvider.java


注:本文中的org.springframework.aop.framework.ProxyFactoryBean.setTarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。