anchor.diff:  [source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
   .Kotlin
   ----
  +    import org.springframework.beans.factory.getBean
  +
   	fun main() {
   		val ctx = ClassPathXmlApplicationContext("scripting/beans.xml")
  -		val messenger = ctx.getBean("messenger") as Messenger
  +		val messenger = ctx.getBean<Messenger>("messenger")
   		println(messenger)
   	}
   ----
  
positive.code: .Kotlin
  [source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
  ----
  	// create and configure beans
      val context = ClassPathXmlApplicationContext("services.xml", "daos.xml")
  
      // retrieve configured instance
      val service = context.getBean("petStore", PetStoreService::class.java)
  
      // use configured instance
      var userList = service.getUsernameList()
  
negative.code: 
  		public static void main(final String[] args) throws Exception {
  			ApplicationContext ctx = new ClassPathXmlApplicationContext("scripting/beans.xml");
  			Messenger messenger = ctx.getBean("messenger", Messenger.class);
  			System.out.println(messenger);
  		}
  
  