Spring Support: Fixed rename of custom-named beans specified with Kotlin annotation

#KT-12096 Fixed
This commit is contained in:
Alexey Sedunov
2016-05-23 15:55:09 +03:00
parent 076e31c0f8
commit ec0f21c887
14 changed files with 126 additions and 19 deletions
@@ -0,0 +1,4 @@
package bean;
public class BeanA {
}
@@ -0,0 +1,8 @@
package bean;
import org.springframework.beans.factory.annotation.Value;
public class JavaRef {
@Value("#{ nameJ }") private BeanA valueA;
@Value("#{ nameK2 }") private BeanA valueK;
}
@@ -0,0 +1,8 @@
package bean
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@Configuration open class KotlinConfig {
@Bean(name = arrayOf("nameK2")) open fun createBeanK() = BeanA()
}
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean class="bean.JavaRef" name="refJ">
<property name="p1" ref="nameJ"/>
<property name="p2" ref="nameK2"/>
</bean>
</beans>
@@ -0,0 +1,11 @@
{
"fixtureClasses": ["org.jetbrains.kotlin.idea.spring.tests.SpringTestFixtureExtension"],
"type": "MARKED_ELEMENT",
"mainFile": "bean/spring-config.xml",
"springFileSet": ["bean/spring-config.xml", "bean/KotlinConfig.kt"],
"newName": "nameK2",
"byRef": "true",
"withRuntime": "true",
"searchInComments": "false",
"searchInTextOccurrences": "false"
}
@@ -0,0 +1,4 @@
package bean;
public class BeanA {
}
@@ -0,0 +1,8 @@
package bean;
import org.springframework.beans.factory.annotation.Value;
public class JavaRef {
@Value("#{ nameJ }") private BeanA valueA;
@Value("#{ nameK }") private BeanA valueK;
}
@@ -0,0 +1,8 @@
package bean
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@Configuration open class KotlinConfig {
@Bean(name = arrayOf("nameK")) open fun createBeanK() = BeanA()
}
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean class="bean.JavaRef" name="refJ">
<property name="p1" ref="nameJ"/>
<property name="p2" ref="/*rename*/nameK"/>
</bean>
</beans>