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

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. 

主站蜘蛛池模板: 张家川| 宁城县| 沙湾县| 林芝县| 北宁市| 梧州市| 满洲里市| 湛江市| 堆龙德庆县| 卢氏县| 吴旗县| 康定县| 碌曲县| 汽车| 碌曲县| 越西县| 龙川县| 衡阳县| 湘阴县| 芜湖市| 通辽市| 林周县| 磐安县| 兰西县| 克东县| 斗六市| 白沙| 海南省| 鄂托克旗| 麻栗坡县| 新干县| 开远市| 桦川县| 潍坊市| 高台县| 张北县| 犍为县| 兴城市| 贵港市| 巫溪县| 合水县|