org.springframework.aop.framework.autoproxy

Class BeanNameAutoProxyCreator

    • Constructor Detail

      • BeanNameAutoProxyCreator

        public BeanNameAutoProxyCreator()
    • Method Detail

      • setBeanNames

        public void setBeanNames(java.lang.String... beanNames)
        Set the names of the beans that should automatically get wrapped with proxies. A name can specify a prefix to match by ending with "*", e.g. "myBean,tx*" will match the bean named "myBean" and all beans whose name start with "tx".

        NOTE: In case of a FactoryBean, only the objects created by the FactoryBean will get proxied. This default behavior applies as of Spring 2.0. If you intend to proxy a FactoryBean instance itself (a rare use case, but Spring 1.2's default behavior), specify the bean name of the FactoryBean including the factory-bean prefix "&": e.g. "&myFactoryBean".

        See Also:
        FactoryBean, BeanFactory.FACTORY_BEAN_PREFIX
      • isMatch

        protected boolean isMatch(java.lang.String beanName,
                                  java.lang.String mappedName)
        Return if the given bean name matches the mapped name.

        The default implementation checks for "xxx*", "*xxx" and "*xxx*" matches, as well as direct equality. Can be overridden in subclasses.

        Parameters:
        beanName - the bean name to check
        mappedName - the name in the configured list of names
        Returns:
        if the names match
        See Also:
        PatternMatchUtils.simpleMatch(String, String)