0

The application is Spring Boot Kotlin

My Controller class

@XRayEnabled
@RestController
open class MyController(private val service: MyService) {
    @GetMapping("/account")
    fun getAccount(@RequestHeader("auth") token: String, @RequestBody account: AccountQuery): ResponseEntity<AccountDetail> = ResponseEntity.ok(service.getAccount(token, account))
}

My service class

@XRayEnabled
@Service
open class MyService(private val client: FeignClient) {
    fun getAccount(token: String, account: AccountQuery): AccountDetail = client.getAccount(token, account)
}

When I access the API endpoint, I got "this.service" is null, how do I inject service into my controller

Yi Qian
  • 127
  • 4
  • 12
  • Here is the answer of my question - https://stackoverflow.com/questions/41298289/spring-boot-autowired-with-kotlin-in-service-is-always-null – Yi Qian Jun 14 '23 at 23:57

0 Answers0