BeanNameAutoProxyCreator 没有excludeBeanNames属性
时间: 2023-11-22 18:53:19 浏览: 36
确实,`BeanNameAutoProxyCreator`没有`excludeBeanNames`属性。如果您想要排除某些bean,则需要使用`BeanNameAutoProxyCreator`的替代方案之一。
一种解决方案是使用`DefaultAdvisorAutoProxyCreator`,它允许您使用`excludeBeanNames`属性来指定要排除的bean。例如:
```xml
<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator">
<property name="advisorBeanNames">
<list>
<value>myAdvisor</value>
</list>
</property>
<property name="excludeBeanNames">
<list>
<value>myBeanToExclude</value>
</list>
</property>
</bean>
```
另一种解决方案是使用`AspectJAutoProxyCreator`,它允许您使用`excludeBean`属性来指定要排除的bean。例如:
```xml
<bean class="org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator">
<property name="excludeBean">
<value>myBeanToExclude</value>
</property>
</bean>
```
请注意,这些替代方案还具有其他属性和行为,因此您需要根据您的需求选择适当的方案。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)