自動裝配一個非原始彈簧註解像如何在基本類型中使用kotlin中的@Autowired或@Value等Spring註釋?
@Autowired
lateinit var metaDataService: MetaDataService
作品。
但是,這並不工作:
@Value("\${cacheTimeSeconds}")
lateinit var cacheTimeSeconds: Int
一個錯誤:
lateinit modifier is not allowed for primitive types.
如何primitve屬性自動裝配成科特林類?
您可以自動導入可空的版本嗎?是否該字段必須遲到 – jrtapsell
是的,var todCacheTimeSeconds:Int? =空作品,但那不是我想要的。 – fkurth