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

  • 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. 

主站蜘蛛池模板: 蒙阴县| 赤壁市| 遵义市| 鹿泉市| 错那县| 舟曲县| 天等县| 新巴尔虎右旗| 于都县| 革吉县| 南阳市| 秦皇岛市| 启东市| 荔浦县| 治多县| 高淳县| 龙岩市| 新邵县| 略阳县| 景谷| 县级市| 城市| 北宁市| 宿松县| 兴和县| 鹤岗市| 深水埗区| 板桥市| 黔江区| 广元市| 武义县| 奉新县| 乌兰察布市| 桓台县| 虎林市| 外汇| 牡丹江市| 南涧| 阜南县| 望都县| 凤山县|