@@ -0,0 +1,3283 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one or more%0A * contributor license agreements.  See the NOTICE file distributed with%0A * this work for additional information regarding copyright ownership.%0A * The ASF licenses this file to You under the Apache License, Version 2.0%0A * (the %22License%22); you may not use this file except in compliance with%0A * the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.apache.dubbo.config.spring.context.config;%0A%0Aimport org.apache.dubbo.config.AbstractConfig;%0Aimport org.apache.dubbo.config.spring.beans.factory.config.DubboConfigDefaultPropertyValueBeanPostProcessor;%0A%0Aimport org.springframework.util.ReflectionUtils;%0A%0Aimport java.beans.PropertyDescriptor;%0Aimport java.lang.reflect.Method;%0Aimport java.util.Arrays;%0A%0Aimport static com.alibaba.spring.util.ObjectUtils.of;%0Aimport static org.springframework.beans.BeanUtils.getPropertyDescriptor;%0A%0A/**%0A * %7B@link DubboConfigBeanCustomizer%7D for the default value for the %22name%22 property that will be taken bean name%0A * if absent.%0A *%0A * @since 2.6.6%0A * @deprecated %7B@link DubboConfigDefaultPropertyValueBeanPostProcessor%7D instead%0A */%0A@Deprecated%0Apublic class NamePropertyDefaultValueDubboConfigBeanCustomizer implements DubboConfigBeanCustomizer %7B%0A%0A    /**%0A     * The bean name of %7B@link NamePropertyDefaultValueDubboConfigBeanCustomizer%7D%0A     *%0A     * @since 2.7.1%0A     */%0A    public static final String BEAN_NAME = %22namePropertyDefaultValueDubboConfigBeanCustomizer%22;%0A%0A    /**%0A     * The name of property that is %22name%22 maybe is absent in target class%0A     */%0A    private static final String PROPERTY_NAME = %22name%22;%0A%0A    @Override%0A    public void customize(String beanName, AbstractConfig dubboConfigBean) %7B%0A%0A        PropertyDescriptor propertyDescriptor = getPropertyDescriptor(dubboConfigBean.getClass(), PROPERTY_NAME);%0A%0A        if (propertyDescriptor != null) %7B // %22name%22 property is present%0A%0A            Method getNameMethod = propertyDescriptor.getReadMethod();%0A%0A            if (getNameMethod == null) %7B // if %22getName%22 method is absent%0A                return;%0A            %7D%0A%0A            Object propertyValue = ReflectionUtils.invokeMethod(getNameMethod, dubboConfigBean);%0A%0A            if (propertyValue != null) %7B // If The return value of %22getName%22 method is not null%0A                return;%0A            %7D%0A%0A            Method setNameMethod = propertyDescriptor.getWriteMethod();%0A            if (setNameMethod != null) %7B // %22setName%22 and %22getName%22 methods are present%0A                if (Arrays.equals(of(String.class), setNameMethod.getParameterTypes())) %7B // the param type is String%0A                    // set bean name to the value of the %22name%22 property%0A                    ReflectionUtils.invokeMethod(setNameMethod, dubboConfigBean, beanName);%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A%0A    @Override%0A    public int getOrder() %7B%0A        return HIGHEST_PRECEDENCE;%0A    %7D%0A%7D%0A

Rollback NamePropertyDefaultValueDubboConfigBeanCustomizer (#5862)