Merge pull request #38708 from quaff
* pr/38708: Cleanup kotlin sources Closes gh-38708
This commit is contained in:
		
						commit
						52baf0003b
					
				| 
						 | 
					@ -40,7 +40,7 @@ class DevProfileSecurityConfiguration {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// tag::customizer[]
 | 
						// tag::customizer[]
 | 
				
			||||||
	private fun <T> yourCustomAuthorization(): Customizer<T> {
 | 
						private fun <T> yourCustomAuthorization(): Customizer<T> {
 | 
				
			||||||
		return Customizer.withDefaults<T>()
 | 
							return Customizer.withDefaults()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// end::customizer[]
 | 
						// end::customizer[]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,7 +29,7 @@ class MyProperties {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var remoteAddress: @NotNull InetAddress? = null
 | 
						var remoteAddress: @NotNull InetAddress? = null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	val security: @Valid Security? = Security()
 | 
						val security: @Valid Security = Security()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	class Security {
 | 
						class Security {
 | 
				
			||||||
		var username: @NotEmpty String? = null
 | 
							var username: @NotEmpty String? = null
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,7 +17,7 @@ package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.springframework.boot.devtools.restart.RestartScope
 | 
					import org.springframework.boot.devtools.restart.RestartScope
 | 
				
			||||||
import org.springframework.boot.test.context.TestConfiguration
 | 
					import org.springframework.boot.test.context.TestConfiguration
 | 
				
			||||||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
 | 
					import org.springframework.boot.testcontainers.service.connection.ServiceConnection
 | 
				
			||||||
import org.springframework.context.annotation.Bean
 | 
					import org.springframework.context.annotation.Bean
 | 
				
			||||||
import org.testcontainers.containers.MongoDBContainer
 | 
					import org.testcontainers.containers.MongoDBContainer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,7 +17,7 @@
 | 
				
			||||||
package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.dynamicproperties
 | 
					package org.springframework.boot.docs.features.testcontainers.atdevelopmenttime.dynamicproperties
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.springframework.boot.test.context.TestConfiguration
 | 
					import org.springframework.boot.test.context.TestConfiguration
 | 
				
			||||||
import org.springframework.context.annotation.Bean;
 | 
					import org.springframework.context.annotation.Bean
 | 
				
			||||||
import org.springframework.test.context.DynamicPropertyRegistry
 | 
					import org.springframework.test.context.DynamicPropertyRegistry
 | 
				
			||||||
import org.testcontainers.containers.MongoDBContainer
 | 
					import org.testcontainers.containers.MongoDBContainer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,8 +27,8 @@ class MyContainersConfiguration {
 | 
				
			||||||
	@Bean
 | 
						@Bean
 | 
				
			||||||
	fun monogDbContainer(properties: DynamicPropertyRegistry): MongoDBContainer {
 | 
						fun monogDbContainer(properties: DynamicPropertyRegistry): MongoDBContainer {
 | 
				
			||||||
		var container = MongoDBContainer("mongo:5.0")
 | 
							var container = MongoDBContainer("mongo:5.0")
 | 
				
			||||||
		properties.add("spring.data.mongodb.host", container::getHost);
 | 
							properties.add("spring.data.mongodb.host", container::getHost)
 | 
				
			||||||
		properties.add("spring.data.mongodb.port", container::getFirstMappedPort);
 | 
							properties.add("spring.data.mongodb.port", container::getFirstMappedPort)
 | 
				
			||||||
		return container
 | 
							return container
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,4 @@ import org.springframework.boot.testcontainers.context.ImportTestcontainers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@TestConfiguration(proxyBeanMethods = false)
 | 
					@TestConfiguration(proxyBeanMethods = false)
 | 
				
			||||||
@ImportTestcontainers(MyContainers::class)
 | 
					@ImportTestcontainers(MyContainers::class)
 | 
				
			||||||
class MyContainersConfiguration {
 | 
					class MyContainersConfiguration
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,7 +31,7 @@ class MyRestClientTests(
 | 
				
			||||||
	@Autowired val server: MockRestServiceServer) {
 | 
						@Autowired val server: MockRestServiceServer) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Test
 | 
						@Test
 | 
				
			||||||
	fun getVehicleDetailsWhenResultIsSuccessShouldReturnDetails(): Unit {
 | 
						fun getVehicleDetailsWhenResultIsSuccessShouldReturnDetails() {
 | 
				
			||||||
		server.expect(MockRestRequestMatchers.requestTo("/greet/details"))
 | 
							server.expect(MockRestRequestMatchers.requestTo("/greet/details"))
 | 
				
			||||||
			.andRespond(MockRestResponseCreators.withSuccess("hello", MediaType.TEXT_PLAIN))
 | 
								.andRespond(MockRestResponseCreators.withSuccess("hello", MediaType.TEXT_PLAIN))
 | 
				
			||||||
		val greeting = service.callRestService()
 | 
							val greeting = service.callRestService()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,7 +17,7 @@
 | 
				
			||||||
package org.springframework.boot.docs.features.testing.springbootapplications.userconfigurationandslicing
 | 
					package org.springframework.boot.docs.features.testing.springbootapplications.userconfigurationandslicing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.springframework.context.annotation.Configuration
 | 
					import org.springframework.context.annotation.Configuration
 | 
				
			||||||
import org.springframework.data.mongodb.config.EnableMongoAuditing;
 | 
					import org.springframework.data.mongodb.config.EnableMongoAuditing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Configuration(proxyBeanMethods = false)
 | 
					@Configuration(proxyBeanMethods = false)
 | 
				
			||||||
@EnableMongoAuditing
 | 
					@EnableMongoAuditing
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,6 @@ package org.springframework.boot.docs.features.testing.springbootapplications.us
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
import org.springframework.boot.test.context.SpringBootTest
 | 
					import org.springframework.boot.test.context.SpringBootTest
 | 
				
			||||||
import org.springframework.boot.test.context.SpringBootTest.UseMainMethod
 | 
					import org.springframework.boot.test.context.SpringBootTest.UseMainMethod
 | 
				
			||||||
import org.springframework.context.annotation.Import
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
@SpringBootTest(useMainMethod = UseMainMethod.ALWAYS)
 | 
					@SpringBootTest(useMainMethod = UseMainMethod.ALWAYS)
 | 
				
			||||||
class MyApplicationTests {
 | 
					class MyApplicationTests {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,6 +26,6 @@ class MyApplication
 | 
				
			||||||
fun main(args: Array<String>) {
 | 
					fun main(args: Array<String>) {
 | 
				
			||||||
	runApplication<MyApplication>(*args) {
 | 
						runApplication<MyApplication>(*args) {
 | 
				
			||||||
		setBannerMode(Banner.Mode.OFF)
 | 
							setBannerMode(Banner.Mode.OFF)
 | 
				
			||||||
		setAdditionalProfiles("myprofile");
 | 
							setAdditionalProfiles("myprofile")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,7 +18,7 @@ package org.springframework.boot.docs.features.testing.testcontainers.servicecon
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.springframework.boot.test.context.TestConfiguration
 | 
					import org.springframework.boot.test.context.TestConfiguration
 | 
				
			||||||
import org.springframework.boot.testcontainers.service.connection.ServiceConnection
 | 
					import org.springframework.boot.testcontainers.service.connection.ServiceConnection
 | 
				
			||||||
import org.springframework.context.annotation.Bean;
 | 
					import org.springframework.context.annotation.Bean
 | 
				
			||||||
import org.testcontainers.containers.GenericContainer
 | 
					import org.testcontainers.containers.GenericContainer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@TestConfiguration(proxyBeanMethods = false)
 | 
					@TestConfiguration(proxyBeanMethods = false)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,7 +14,7 @@
 | 
				
			||||||
 * limitations under the License.
 | 
					 * limitations under the License.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package org.springframework.boot.docs.web.graphql.runtimewiring;
 | 
					package org.springframework.boot.docs.web.graphql.runtimewiring
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.springframework.graphql.data.method.annotation.Argument
 | 
					import org.springframework.graphql.data.method.annotation.Argument
 | 
				
			||||||
import org.springframework.graphql.data.method.annotation.QueryMapping
 | 
					import org.springframework.graphql.data.method.annotation.QueryMapping
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,7 +19,6 @@ package org.springframework.boot.docs.web.security.springwebflux
 | 
				
			||||||
import org.springframework.boot.autoconfigure.security.reactive.PathRequest
 | 
					import org.springframework.boot.autoconfigure.security.reactive.PathRequest
 | 
				
			||||||
import org.springframework.context.annotation.Bean
 | 
					import org.springframework.context.annotation.Bean
 | 
				
			||||||
import org.springframework.context.annotation.Configuration
 | 
					import org.springframework.context.annotation.Configuration
 | 
				
			||||||
import org.springframework.security.config.Customizer
 | 
					 | 
				
			||||||
import org.springframework.security.config.Customizer.withDefaults
 | 
					import org.springframework.security.config.Customizer.withDefaults
 | 
				
			||||||
import org.springframework.security.config.web.server.ServerHttpSecurity
 | 
					import org.springframework.security.config.web.server.ServerHttpSecurity
 | 
				
			||||||
import org.springframework.security.web.server.SecurityWebFilterChain
 | 
					import org.springframework.security.web.server.SecurityWebFilterChain
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,8 +4,7 @@ import org.springframework.boot.SpringBootConfiguration
 | 
				
			||||||
import org.springframework.boot.runApplication
 | 
					import org.springframework.boot.runApplication
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@SpringBootConfiguration(proxyBeanMethods = false)
 | 
					@SpringBootConfiguration(proxyBeanMethods = false)
 | 
				
			||||||
open class KotlinApplicationWithMainThrowingException {
 | 
					open class KotlinApplicationWithMainThrowingException
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
fun main(args: Array<String>) {
 | 
					fun main(args: Array<String>) {
 | 
				
			||||||
	runApplication<KotlinApplicationWithMainThrowingException>(*args)
 | 
						runApplication<KotlinApplicationWithMainThrowingException>(*args)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,9 +18,7 @@ package org.springframework.boot.test.context
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.assertj.core.api.Assertions.assertThatIllegalStateException
 | 
					import org.assertj.core.api.Assertions.assertThatIllegalStateException
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
import org.springframework.boot.SpringBootConfiguration
 | 
					 | 
				
			||||||
import org.springframework.boot.test.context.SpringBootTest.UseMainMethod
 | 
					import org.springframework.boot.test.context.SpringBootTest.UseMainMethod
 | 
				
			||||||
import org.springframework.context.annotation.Configuration
 | 
					 | 
				
			||||||
import org.springframework.test.context.TestContext
 | 
					import org.springframework.test.context.TestContext
 | 
				
			||||||
import org.springframework.test.context.TestContextManager
 | 
					import org.springframework.test.context.TestContextManager
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,3 @@
 | 
				
			||||||
import org.springframework.boot.gradle.tasks.run.BootRun
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
plugins {
 | 
					plugins {
 | 
				
			||||||
	java
 | 
						java
 | 
				
			||||||
	application
 | 
						application
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,3 @@
 | 
				
			||||||
import org.springframework.boot.gradle.tasks.run.BootRun
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
plugins {
 | 
					plugins {
 | 
				
			||||||
	java
 | 
						java
 | 
				
			||||||
	application
 | 
						application
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,6 @@ import org.springframework.util.Assert
 | 
				
			||||||
import org.springframework.util.ClassUtils
 | 
					import org.springframework.util.ClassUtils
 | 
				
			||||||
import org.springframework.util.ReflectionUtils
 | 
					import org.springframework.util.ReflectionUtils
 | 
				
			||||||
import kotlin.reflect.KClass
 | 
					import kotlin.reflect.KClass
 | 
				
			||||||
import kotlin.reflect.KType
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Top-level function acting as a Kotlin shortcut allowing to write
 | 
					 * Top-level function acting as a Kotlin shortcut allowing to write
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,7 +38,7 @@ class KotlinConfigurationPropertiesTests {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@AfterEach
 | 
						@AfterEach
 | 
				
			||||||
	fun cleanUp() {
 | 
						fun cleanUp() {
 | 
				
			||||||
		this.context.close();
 | 
							this.context.close()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Test //gh-18652
 | 
						@Test //gh-18652
 | 
				
			||||||
| 
						 | 
					@ -48,22 +48,22 @@ class KotlinConfigurationPropertiesTests {
 | 
				
			||||||
				RootBeanDefinition(BingProperties::class.java))
 | 
									RootBeanDefinition(BingProperties::class.java))
 | 
				
			||||||
		beanFactory.registerSingleton("foo", BingProperties(""))
 | 
							beanFactory.registerSingleton("foo", BingProperties(""))
 | 
				
			||||||
		this.context.register(EnableConfigProperties::class.java)
 | 
							this.context.register(EnableConfigProperties::class.java)
 | 
				
			||||||
		this.context.refresh();
 | 
							this.context.refresh()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Test
 | 
						@Test
 | 
				
			||||||
	fun `type with constructor bound lateinit property can be bound`() {
 | 
						fun `type with constructor bound lateinit property can be bound`() {
 | 
				
			||||||
		this.context.register(EnableLateInitProperties::class.java)
 | 
							this.context.register(EnableLateInitProperties::class.java)
 | 
				
			||||||
		TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "lateinit.inner.value=alpha");
 | 
							TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "lateinit.inner.value=alpha")
 | 
				
			||||||
		this.context.refresh();
 | 
							this.context.refresh()
 | 
				
			||||||
		assertThat(this.context.getBean(LateInitProperties::class.java).inner.value).isEqualTo("alpha")
 | 
							assertThat(this.context.getBean(LateInitProperties::class.java).inner.value).isEqualTo("alpha")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Test
 | 
						@Test
 | 
				
			||||||
	fun `type with constructor bound lateinit property with default can be bound`() {
 | 
						fun `type with constructor bound lateinit property with default can be bound`() {
 | 
				
			||||||
		this.context.register(EnableLateInitPropertiesWithDefault::class.java)
 | 
							this.context.register(EnableLateInitPropertiesWithDefault::class.java)
 | 
				
			||||||
		TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "lateinit-with-default.inner.bravo=two");
 | 
							TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "lateinit-with-default.inner.bravo=two")
 | 
				
			||||||
		this.context.refresh();
 | 
							this.context.refresh()
 | 
				
			||||||
		val properties = this.context.getBean(LateInitPropertiesWithDefault::class.java)
 | 
							val properties = this.context.getBean(LateInitPropertiesWithDefault::class.java)
 | 
				
			||||||
		assertThat(properties.inner.alpha).isEqualTo("apple")
 | 
							assertThat(properties.inner.alpha).isEqualTo("apple")
 | 
				
			||||||
		assertThat(properties.inner.bravo).isEqualTo("two")
 | 
							assertThat(properties.inner.bravo).isEqualTo("two")
 | 
				
			||||||
| 
						 | 
					@ -72,20 +72,16 @@ class KotlinConfigurationPropertiesTests {
 | 
				
			||||||
	@Test
 | 
						@Test
 | 
				
			||||||
	fun `mutable data class properties can be imported`() {
 | 
						fun `mutable data class properties can be imported`() {
 | 
				
			||||||
		this.context.register(MutableDataClassPropertiesImporter::class.java)
 | 
							this.context.register(MutableDataClassPropertiesImporter::class.java)
 | 
				
			||||||
		TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "mutable.prop=alpha");
 | 
							TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "mutable.prop=alpha")
 | 
				
			||||||
		this.context.refresh();
 | 
							this.context.refresh()
 | 
				
			||||||
		assertThat(this.context.getBean(MutableDataClassProperties::class.java).prop).isEqualTo("alpha")
 | 
							assertThat(this.context.getBean(MutableDataClassProperties::class.java).prop).isEqualTo("alpha")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@ConfigurationProperties(prefix = "foo")
 | 
						@ConfigurationProperties(prefix = "foo")
 | 
				
			||||||
	class BingProperties(@Suppress("UNUSED_PARAMETER") bar: String) {
 | 
						class BingProperties(@Suppress("UNUSED_PARAMETER") bar: String)
 | 
				
			||||||
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@EnableConfigurationProperties
 | 
						@EnableConfigurationProperties
 | 
				
			||||||
	class EnableConfigProperties {
 | 
						class EnableConfigProperties
 | 
				
			||||||
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@ConfigurationProperties("lateinit")
 | 
						@ConfigurationProperties("lateinit")
 | 
				
			||||||
	class LateInitProperties {
 | 
						class LateInitProperties {
 | 
				
			||||||
| 
						 | 
					@ -97,9 +93,7 @@ class KotlinConfigurationPropertiesTests {
 | 
				
			||||||
	data class Inner(val value: String)
 | 
						data class Inner(val value: String)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@EnableConfigurationProperties(LateInitPropertiesWithDefault::class)
 | 
						@EnableConfigurationProperties(LateInitPropertiesWithDefault::class)
 | 
				
			||||||
	class EnableLateInitPropertiesWithDefault {
 | 
						class EnableLateInitPropertiesWithDefault
 | 
				
			||||||
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@ConfigurationProperties("lateinit-with-default")
 | 
						@ConfigurationProperties("lateinit-with-default")
 | 
				
			||||||
	class LateInitPropertiesWithDefault {
 | 
						class LateInitPropertiesWithDefault {
 | 
				
			||||||
| 
						 | 
					@ -111,15 +105,12 @@ class KotlinConfigurationPropertiesTests {
 | 
				
			||||||
	data class InnerWithDefault(val alpha: String = "apple", val bravo: String = "banana")
 | 
						data class InnerWithDefault(val alpha: String = "apple", val bravo: String = "banana")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@EnableConfigurationProperties(LateInitProperties::class)
 | 
						@EnableConfigurationProperties(LateInitProperties::class)
 | 
				
			||||||
	class EnableLateInitProperties {
 | 
						class EnableLateInitProperties
 | 
				
			||||||
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@EnableConfigurationProperties
 | 
						@EnableConfigurationProperties
 | 
				
			||||||
	@Configuration(proxyBeanMethods = false)
 | 
						@Configuration(proxyBeanMethods = false)
 | 
				
			||||||
	@Import(MutableDataClassProperties::class)
 | 
						@Import(MutableDataClassProperties::class)
 | 
				
			||||||
	class MutableDataClassPropertiesImporter {
 | 
						class MutableDataClassPropertiesImporter
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@ConfigurationProperties(prefix = "mutable")
 | 
						@ConfigurationProperties(prefix = "mutable")
 | 
				
			||||||
	data class MutableDataClassProperties(
 | 
						data class MutableDataClassProperties(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,6 @@ import org.assertj.core.api.Assertions.assertThat
 | 
				
			||||||
import org.junit.jupiter.api.Test
 | 
					import org.junit.jupiter.api.Test
 | 
				
			||||||
import org.springframework.aot.hint.MemberCategory
 | 
					import org.springframework.aot.hint.MemberCategory
 | 
				
			||||||
import org.springframework.aot.hint.RuntimeHints
 | 
					import org.springframework.aot.hint.RuntimeHints
 | 
				
			||||||
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,7 +14,7 @@
 | 
				
			||||||
 * limitations under the License.
 | 
					 * limitations under the License.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package org.springframework.boot.context.properties.bind;
 | 
					package org.springframework.boot.context.properties.bind
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.assertj.core.api.Assertions.assertThat
 | 
					import org.assertj.core.api.Assertions.assertThat
 | 
				
			||||||
import org.assertj.core.api.Assertions.assertThatIllegalStateException
 | 
					import org.assertj.core.api.Assertions.assertThatIllegalStateException
 | 
				
			||||||
| 
						 | 
					@ -46,7 +46,7 @@ class KotlinDefaultBindConstructorProviderTests {
 | 
				
			||||||
	@Test
 | 
						@Test
 | 
				
			||||||
	fun `type with primary and secondary annotated constructor should use secondary constructor for binding`() {
 | 
						fun `type with primary and secondary annotated constructor should use secondary constructor for binding`() {
 | 
				
			||||||
		val bindConstructor = this.constructorProvider.getBindConstructor(ConstructorBindingOnSecondaryWithPrimaryConstructor::class.java, false)
 | 
							val bindConstructor = this.constructorProvider.getBindConstructor(ConstructorBindingOnSecondaryWithPrimaryConstructor::class.java, false)
 | 
				
			||||||
		assertThat(bindConstructor).isNotNull();
 | 
							assertThat(bindConstructor).isNotNull()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Test
 | 
						@Test
 | 
				
			||||||
| 
						 | 
					@ -116,12 +116,12 @@ class KotlinDefaultBindConstructorProviderTests {
 | 
				
			||||||
	@Test
 | 
						@Test
 | 
				
			||||||
	fun `data class with default values should use constructor binding`() {
 | 
						fun `data class with default values should use constructor binding`() {
 | 
				
			||||||
		val bindConstructor = this.constructorProvider.getBindConstructor(ConstructorBindingDataClassWithDefaultValues::class.java, false)
 | 
							val bindConstructor = this.constructorProvider.getBindConstructor(ConstructorBindingDataClassWithDefaultValues::class.java, false)
 | 
				
			||||||
		assertThat(bindConstructor).isNotNull();
 | 
							assertThat(bindConstructor).isNotNull()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	class FooProperties
 | 
						class FooProperties
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	class PrimaryWithAutowiredSecondaryProperties constructor(val name: String?, val counter: Int = 42) {
 | 
						class PrimaryWithAutowiredSecondaryProperties(val name: String?, val counter: Int = 42) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		@Autowired
 | 
							@Autowired
 | 
				
			||||||
		constructor(@Suppress("UNUSED_PARAMETER") foo: String) : this(foo, 21)
 | 
							constructor(@Suppress("UNUSED_PARAMETER") foo: String) : this(foo, 21)
 | 
				
			||||||
| 
						 | 
					@ -133,9 +133,7 @@ class KotlinDefaultBindConstructorProviderTests {
 | 
				
			||||||
		constructor(@Suppress("UNUSED_PARAMETER") foo: String)
 | 
							constructor(@Suppress("UNUSED_PARAMETER") foo: String)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	class AutowiredPrimaryProperties @Autowired constructor(val name: String?, val counter: Int = 42) {
 | 
						class AutowiredPrimaryProperties @Autowired constructor(val name: String?, val counter: Int = 42)
 | 
				
			||||||
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	class ConstructorBindingOnSecondaryAndAutowiredPrimaryProperties @Autowired constructor(val name: String?, val counter: Int = 42) {
 | 
						class ConstructorBindingOnSecondaryAndAutowiredPrimaryProperties @Autowired constructor(val name: String?, val counter: Int = 42) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -149,7 +147,7 @@ class KotlinDefaultBindConstructorProviderTests {
 | 
				
			||||||
		constructor(@Suppress("UNUSED_PARAMETER") foo: String) : this(foo, 21)
 | 
							constructor(@Suppress("UNUSED_PARAMETER") foo: String) : this(foo, 21)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	class ConstructorBindingOnSecondaryWithPrimaryConstructor constructor(val name: String?, val counter: Int = 42) {
 | 
						class ConstructorBindingOnSecondaryWithPrimaryConstructor(val name: String?, val counter: Int = 42) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		@ConstructorBinding
 | 
							@ConstructorBinding
 | 
				
			||||||
		constructor(@Suppress("UNUSED_PARAMETER") foo: String) : this(foo, 21)
 | 
							constructor(@Suppress("UNUSED_PARAMETER") foo: String) : this(foo, 21)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue