ishankhemani commented on code in PR #15889:
URL: https://github.com/apache/dubbo/pull/15889#discussion_r2641900135


##########
dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/ReferenceBeanTypeInjectionTest.java:
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.config.spring;
+
+import org.apache.dubbo.config.annotation.DubboReference;
+
+import org.junit.jupiter.api.Test;
+import 
org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+class ReferenceBeanTypeInjectionTest {
+
+    @Test
+    void testReferenceInjectionDoesNotThrowBeanNotOfRequiredTypeException() {
+        // Context startup itself is the assertion
+        new AnnotationConfigApplicationContext(TestConfig.class).close();

Review Comment:
   Thanks for checking.
   
   The test is not meant to reproduce a current failure on master, but to act 
as a
   regression test for the reported issue.
   
   The original problem occurs in specific scenarios where ReferenceBean is 
injected
   into constructor-managed beans and Spring performs early type resolution.
   Without this change, getObjectType() may return an incompatible or undefined 
type,
   leading to BeanNotOfRequiredTypeException.
   
   This test ensures that future changes do not reintroduce the incorrect 
behavior
   during Spring’s dependency resolution phase.
   



-- 
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]

Reply via email to