Answers for "kotlin dependency injection"

0

kotlin dependency injection

@Component
class Car @Autowired constructor (private val owner: Owner) {
    fun getOwner() : Owner {
        return owner
    }
}

class Owner(private val name: String, private val address: String) {}
Posted by: Guest on October-23-2021
0

kotlin dependency injection

class Bug {
   lateinit var desc: String;
   lateinit var latestComment: String;
   
    // a setter method so that the Spring container can inject desc and latestComment dependencies
   @Autowired
   fun updateBug(desc: String, latestComment: String) {
       this.desc = desc;
       this.latestComment = latestComment;
   }
}
Posted by: Guest on October-23-2021

Code answers related to "kotlin dependency injection"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language