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

  • Kotlin Blueprints
  • Ashish Belagali Hardik Trivedi Akshay Chordiya
  • 140字
  • 2021-07-02 21:50:19

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. 

主站蜘蛛池模板: 牡丹江市| 库伦旗| 乃东县| 乾安县| 赤峰市| 颍上县| 铁岭市| 临泽县| 怀化市| 呼和浩特市| 洪湖市| 枣庄市| 洪洞县| 马龙县| 乌兰县| 铜梁县| 沙湾县| 神农架林区| 高密市| 昂仁县| 额尔古纳市| 潢川县| 旬阳县| 台中县| 灵丘县| 南平市| 镇平县| 桑日县| 南开区| 商南县| 南丹县| 霍城县| 乃东县| 长寿区| 应城市| 焦作市| 胶南市| 闸北区| 体育| 东海县| 福安市|