- 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.
推薦閱讀
- Learning Scala Programming
- Java Web開發(fā)學(xué)習(xí)手冊
- SQL Server 2012數(shù)據(jù)庫技術(shù)及應(yīng)用(微課版·第5版)
- Developing Middleware in Java EE 8
- INSTANT Weka How-to
- Practical Windows Forensics
- Java Web程序設(shè)計(jì)任務(wù)教程
- Clojure Reactive Programming
- Lighttpd源碼分析
- 利用Python進(jìn)行數(shù)據(jù)分析
- Python算法詳解
- 大數(shù)據(jù)時(shí)代的企業(yè)升級之道(全3冊)
- R的極客理想:量化投資篇
- Java Hibernate Cookbook
- 計(jì)算機(jī)組裝與維護(hù)(第二版)