org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator Java Examples

The following examples show how to use org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TransactionalConfig.java    From spring-boot-start-current with Apache License 2.0 6 votes vote down vote up
/**
 * 配置事务拦截
 * <p>
 * {@link #customizeTransactionInterceptor(PlatformTransactionManager)}
 */
@Bean
public BeanNameAutoProxyCreator customizeTransactionBeanNameAutoProxyCreator () {
	BeanNameAutoProxyCreator beanNameAutoProxyCreator = new BeanNameAutoProxyCreator();
	// 设置定制的事务拦截器
	beanNameAutoProxyCreator.setInterceptorNames( CUSTOMIZE_TRANSACTION_INTERCEPTOR_NAME );
	List< String > transactionBeanNames = new ArrayList<>( DEFAULT_TRANSACTION_BEAN_NAMES.length + customizeTransactionBeanNames.length );
	// 默认
	transactionBeanNames.addAll( Arrays.asList( DEFAULT_TRANSACTION_BEAN_NAMES ) );
	// 定制
	transactionBeanNames.addAll( Arrays.asList( customizeTransactionBeanNames ) );
	// 归集
	for ( String transactionBeanName : transactionBeanNames ) {
		beanNameAutoProxyCreator.setBeanNames( transactionBeanName );
	}
	beanNameAutoProxyCreator.setProxyTargetClass( true );
	return beanNameAutoProxyCreator;
}
 
Example #2
Source File: DruidConfig.java    From SpringBoot-Base-System with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 必须使用Qualifier 否则注入失败
 * 
 * @time 2018年4月10日 下午5:00:31.
 * @version V1.0
 * @return BeanNameAutoProxyCreator
 */
@Bean
@Qualifier("druid-stat-interceptor") // 注入上面的bean
public BeanNameAutoProxyCreator getBeanNameAutoProxyCreator() {
	BeanNameAutoProxyCreator beanNameAutoProxyCreator = new BeanNameAutoProxyCreator();
	beanNameAutoProxyCreator.setInterceptorNames("druid-stat-interceptor"); // 关联
	beanNameAutoProxyCreator.setBeanNames("*Service", "*Dao");
	beanNameAutoProxyCreator.setProxyTargetClass(true);
	return beanNameAutoProxyCreator;
}
 
Example #3
Source File: InterceptorConfig.java    From micro-service with MIT License 5 votes vote down vote up
@Bean
public BeanNameAutoProxyCreator beanNameAutoProxyCreator() {
	
	BeanNameAutoProxyCreator creator = new BeanNameAutoProxyCreator();
	creator.setProxyTargetClass(true);
	creator.setBeanNames("classesController");
	creator.setInterceptorNames("druidStatInterceptor");
	
	System.out.println("load druid stat interceptor...");
	
	return creator;
}
 
Example #4
Source File: InterceptorConfig.java    From micro-service with MIT License 5 votes vote down vote up
@Bean
public BeanNameAutoProxyCreator beanNameAutoProxyCreator() {
	
	BeanNameAutoProxyCreator creator = new BeanNameAutoProxyCreator();
	creator.setProxyTargetClass(true);
	creator.setBeanNames("companyController", "organizationController", "personController", "qRCodeController");
	creator.setInterceptorNames("druidStatInterceptor");
	
	System.out.println("load druid stat interceptor...");
	
	return creator;
}
 
Example #5
Source File: AutoProxyLazyInitTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Bean
public BeanNameAutoProxyCreator lazyInitAutoProxyCreator() {
	BeanNameAutoProxyCreator autoProxyCreator = new BeanNameAutoProxyCreator();
	autoProxyCreator.setCustomTargetSourceCreators(lazyInitTargetSourceCreator());
	return autoProxyCreator;
}
 
Example #6
Source File: AutoProxyLazyInitTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Bean
public BeanNameAutoProxyCreator lazyInitAutoProxyCreator() {
	BeanNameAutoProxyCreator autoProxyCreator = new BeanNameAutoProxyCreator();
	autoProxyCreator.setCustomTargetSourceCreators(lazyInitTargetSourceCreator());
	return autoProxyCreator;
}
 
Example #7
Source File: AutoProxyLazyInitTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Bean
public BeanNameAutoProxyCreator lazyInitAutoProxyCreator() {
	BeanNameAutoProxyCreator autoProxyCreator = new BeanNameAutoProxyCreator();
	autoProxyCreator.setCustomTargetSourceCreators(lazyInitTargetSourceCreator());
	return autoProxyCreator;
}
 
Example #8
Source File: AutoProxyLazyInitTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Bean
public BeanNameAutoProxyCreator lazyInitAutoProxyCreator() {
	BeanNameAutoProxyCreator autoProxyCreator = new BeanNameAutoProxyCreator();
	autoProxyCreator.setCustomTargetSourceCreators(lazyInitTargetSourceCreator());
	return autoProxyCreator;
}
 
Example #9
Source File: AutoProxyLazyInitTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Bean
public BeanNameAutoProxyCreator lazyInitAutoProxyCreator() {
	BeanNameAutoProxyCreator autoProxyCreator = new BeanNameAutoProxyCreator();
	autoProxyCreator.setCustomTargetSourceCreators(lazyInitTargetSourceCreator());
	return autoProxyCreator;
}
 
Example #10
Source File: AutoProxyLazyInitTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Bean
public BeanNameAutoProxyCreator lazyInitAutoProxyCreator() {
	BeanNameAutoProxyCreator autoProxyCreator = new BeanNameAutoProxyCreator();
	autoProxyCreator.setCustomTargetSourceCreators(lazyInitTargetSourceCreator());
	return autoProxyCreator;
}
 
Example #11
Source File: AutoProxyLazyInitTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Bean
public BeanNameAutoProxyCreator lazyInitAutoProxyCreator() {
	BeanNameAutoProxyCreator autoProxyCreator = new BeanNameAutoProxyCreator();
	autoProxyCreator.setCustomTargetSourceCreators(lazyInitTargetSourceCreator());
	return autoProxyCreator;
}
 
Example #12
Source File: AutoProxyLazyInitTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Bean
public BeanNameAutoProxyCreator lazyInitAutoProxyCreator() {
	BeanNameAutoProxyCreator autoProxyCreator = new BeanNameAutoProxyCreator();
	autoProxyCreator.setCustomTargetSourceCreators(lazyInitTargetSourceCreator());
	return autoProxyCreator;
}
 
Example #13
Source File: AutoProxyLazyInitTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Bean
public BeanNameAutoProxyCreator lazyInitAutoProxyCreator() {
	BeanNameAutoProxyCreator autoProxyCreator = new BeanNameAutoProxyCreator();
	autoProxyCreator.setCustomTargetSourceCreators(lazyInitTargetSourceCreator());
	return autoProxyCreator;
}
 
Example #14
Source File: AutoProxyLazyInitTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Bean
public BeanNameAutoProxyCreator lazyInitAutoProxyCreator() {
	BeanNameAutoProxyCreator autoProxyCreator = new BeanNameAutoProxyCreator();
	autoProxyCreator.setCustomTargetSourceCreators(lazyInitTargetSourceCreator());
	return autoProxyCreator;
}
 
Example #15
Source File: AutoProxyLazyInitTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Bean
public BeanNameAutoProxyCreator lazyInitAutoProxyCreator() {
	BeanNameAutoProxyCreator autoProxyCreator = new BeanNameAutoProxyCreator();
	autoProxyCreator.setCustomTargetSourceCreators(lazyInitTargetSourceCreator());
	return autoProxyCreator;
}
 
Example #16
Source File: AutoProxyLazyInitTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Bean
public BeanNameAutoProxyCreator lazyInitAutoProxyCreator() {
	BeanNameAutoProxyCreator autoProxyCreator = new BeanNameAutoProxyCreator();
	autoProxyCreator.setCustomTargetSourceCreators(lazyInitTargetSourceCreator());
	return autoProxyCreator;
}