#1 @Autowired and how to subclass methods in Kotlin

#1 @Autowired and how to subclass methods in Kotlin

  1. Since Spring Framework version 4.3 the @Autowired annotation can be omitted on the constructor of a Spring bean, as long as it only defines a single constructor. When defining multiple constructors you still need to mark one with the @Autowired annotation.
  2. In Kotlin it is possible to subclass methods:
class Subclass(val name: String) : () -> String {
    override fun invoke(): String {
        return name
    }
}

 

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert