- 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.
推薦閱讀
- Python Game Programming By Example
- C語言程序設計實踐教程
- Python Network Programming Cookbook(Second Edition)
- 差分進化算法及其高維多目標優化應用
- Haskell Data Analysis Cookbook
- Learning Laravel's Eloquent
- 微信小程序全棧開發技術與實戰(微課版)
- Microsoft Dynamics AX 2012 R3 Financial Management
- Learning YARN
- Vue.js應用測試
- Android應用開發實戰
- 深度學習程序設計實戰
- Practical Predictive Analytics
- Hack與HHVM權威指南
- Java程序設計入門(第2版)