GaneshPatil7517 commented on code in PR #16005: URL: https://github.com/apache/dubbo/pull/16005#discussion_r2697072833
########## 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: You're absolutely right. This test validates that Dubbo Spring Boot integration works in general, but it doesn't specifically demonstrate what this PR fixes. Looking at this more carefully, I think the appropriate action is to remove the test file entirely from this PR. The core value of this PR is: Adding .imports files for EnvironmentPostProcessor and ApplicationContextInitializer registration (ensures proper loading in Spring Boot 3.x) Adding missing DubboExtensionEndpointAutoConfiguration to [spring.factories](vscode-file://vscode-app/c:/Users/HP/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html) Making [SpringBoot3Condition](vscode-file://vscode-app/c:/Users/HP/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html) null-safe These are configuration/registration changes that are best validated through integration testing in a real Spring Boot 3.5.x application, not through unit tests that would pass regardless. I'll remove the test file and push an updated commit. Thank you for the feedback. -- 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]
