- 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.
推薦閱讀
- Mastering Concurrency Programming with Java 8
- LabVIEW 2018 虛擬儀器程序設(shè)計(jì)
- 零基礎(chǔ)搭建量化投資系統(tǒng):以Python為工具
- Mastering Entity Framework
- 程序員面試算法寶典
- Git高手之路
- Securing WebLogic Server 12c
- Web程序設(shè)計(jì)(第二版)
- Getting Started with Hazelcast(Second Edition)
- Cybersecurity Attacks:Red Team Strategies
- 從零開始學(xué)Linux編程
- Beginning C# 7 Hands-On:The Core Language
- Java EE輕量級解決方案:S2SH
- 讀故事學(xué)編程:Python王國歷險(xiǎn)記
- Mastering PostgreSQL 11(Second Edition)