anchor.diff:  * https://try.kotlinlang.org/[Try Kotlin in your browser]
   * https://blog.jetbrains.com/kotlin/[Kotlin blog]
   * https://kotlin.link/[Awesome Kotlin]
  -
  -
  -
  -=== Tutorials
  -
  -We recommend the following tutorials:
  -
  -* https://spring.io/guides/tutorials/spring-boot-kotlin/[Building web applications with Spring Boot and Kotlin]
  -* https://kotlinlang.org/docs/tutorials/spring-boot-restful.html[Creating a RESTful Web Service with Spring Boot]
  -
  -
  -
  -=== Blog posts
  -
  -The following blog posts provide further details:
  -
  -* https://spring.io/blog/2016/02/15/developing-spring-boot-applications-with-kotlin[Developing Spring Boot applications with Kotlin]
  -* https://spring.io/blog/2016/03/20/a-geospatial-messenger-with-kotlin-spring-boot-and-postgresql[A Geospatial Messenger with Kotlin, Spring Boot and PostgreSQL]
  -* https://spring.io/blog/2017/01/04/introducing-kotlin-support-in-spring-framework-5-0[Introducing Kotlin support in Spring Framework 5.0]
  -* https://spring.io/blog/2017/08/01/spring-framework-5-kotlin-apis-the-functional-way[Spring Framework 5 Kotlin APIs, the functional way]
  -
   
   
   === Examples
  
positive.code: ====
  [source,kotlin,indent=0]
  ----
  	fun beans() = beans {
  		bean<UserHandler>()
  		bean<Routes>()
  		bean<WebHandler>("webHandler") {
  			RouterFunctions.toWebHandler(
  				ref<Routes>().router(),
  				HandlerStrategies.builder().viewResolver(ref()).build()
  			)
  		}
  		bean("messageSource") {
  			ReloadableResourceBundleMessageSource().apply {
  				setBasename("messages")
  				setDefaultEncoding("UTF-8")
  			}
  		}
  		bean {
  			val prefix = "classpath:/templates/"
  			val suffix = ".mustache"
  			val loader = MustacheResourceTemplateLoader(prefix, suffix)
  			MustacheViewResolver(Mustache.compiler().withLoader(loader)).apply {
  				setPrefix(prefix)
  				setSuffix(suffix)
  			}
  		}
  		profile("play") {
  			bean<Play>()
  		}
  	}
  ----
  ====
  
  In the preceding example, `bean<Routes>()` uses autowiring by constructor, and `ref<Routes>()`
  is a shortcut for `applicationContext.getBean(Routes::class.java)`.
  
  You can then use this `beans()` function to register beans on the application context,
  as the following example shows:
  
negative.code: [source,kotlin,indent=0]
  ----
  	val context = GenericApplicationContext().apply {
  		myBeans.initialize(this)
  		refresh()
  	}
  ----
  ====
  
  
  See https://github.com/sdeleuze/spring-kotlin-functional[spring-kotlin-functional beans declaration] for a concrete example.
  
  NOTE: Spring Boot is based on JavaConfig and
  https://github.com/spring-projects/spring-boot/issues/8115[does not yet provide specific support for functional bean definition],
  but you can experimentally use functional bean definitions through Spring Boot's `ApplicationContextInitializer` support.
  See https://stackoverflow.com/questions/45935931/how-to-use-functional-bean-definition-kotlin-dsl-with-spring-boot-and-spring-w/46033685#46033685[this Stack Overflow answer]
  