官术网_书友最值得收藏!

All-open compiler plugin

By default, classes and the functions in Kotlin are final. In order to make a particular class or function non-final you need to use the open keyword. It is one of the pain points of using Kotlin with Spring as the classes for external configuration properties (Spring beans proxified with CGLIB like @Configuration classes) are required to be open.

Fortunately, with Kotlin v1.0.6, there is a Kotlin-Spring plugin that tells the compiler to open classes and their member functions for classes annotated or meta-annotated with one of the following annotations: 

  • @Component
  • @Async
  • @Transactional
  • @Cacheable
  • Also, classes annotated with @Configuration, @Controller, @RestController, @Service, or @Repository are automatically opened since these annotations are meta-annotated with @Component

In a nutshell, it becomes much easier to open the required configuration classes by using Spring. 

主站蜘蛛池模板: 察隅县| 密云县| 博爱县| 岚皋县| 红原县| 中江县| 久治县| 宜丰县| 乐都县| 阿城市| 马龙县| 阜平县| 天全县| 长兴县| 沾益县| 龙胜| 海城市| 印江| 三河市| 土默特右旗| 阳春市| 泸水县| 拜城县| 乌鲁木齐市| 太原市| 修水县| 武陟县| 宜州市| 和平县| 仙居县| 鄂伦春自治旗| 枞阳县| 米脂县| 景谷| 屏东市| 正镶白旗| 太谷县| 通州市| 怀来县| 贡嘎县| 横峰县|