zrlw commented on code in PR #16005: URL: https://github.com/apache/dubbo/pull/16005#discussion_r2696989408
########## dubbo-spring-boot-project/dubbo-spring-boot-autoconfigure/src/test/java/org/apache/dubbo/spring/boot/autoconfigure/SpringBoot3CompatibilityTest.java: ########## @@ -0,0 +1,159 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dubbo.spring.boot.autoconfigure; + +import org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor; +import org.apache.dubbo.config.spring.beans.factory.annotation.ServiceAnnotationPostProcessor; +import org.apache.dubbo.config.spring.util.DubboBeanUtils; +import org.apache.dubbo.spring.boot.env.DubboDefaultPropertiesEnvironmentPostProcessor; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.ObjectProvider; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringBootVersion; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.env.Environment; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Spring Boot Compatibility Test + * + * This test validates that Dubbo's Spring Boot integration works correctly across + * Spring Boot versions (2.x and 3.x) and is prepared for Spring Cloud 2025.0.0 compatibility. + * + * Key areas tested: + * - AutoConfiguration loading (works with both spring.factories and .imports files) + * - EnvironmentPostProcessor registration + * - ApplicationContextInitializer registration + * - Bean post processors for Dubbo annotations + * - Version detection conditions + * + * @since 3.3.7 + * @see DubboAutoConfiguration + * @see DubboDefaultPropertiesEnvironmentPostProcessor + */ +@ExtendWith(SpringExtension.class) +@SpringBootTest( + classes = {SpringBoot3CompatibilityTest.class}, + properties = { + "dubbo.scan.base-packages=org.apache.dubbo.spring.boot.autoconfigure", + "spring.application.name=dubbo-spring-boot-compat-test" + }) +@EnableAutoConfiguration +@PropertySource(value = "classpath:/META-INF/dubbo.properties") +class SpringBoot3CompatibilityTest { Review Comment: It will run successfully no matter applying this pr or not, so write this testcase to demonstrate what? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
