spring - Spring Boot Kotlin 项目在 Eclipse 中不起作用
问题描述
我有一个在 Eclipse 中运行的 Spring Boot 项目,具有以下版本
Spring Boot: 2.1.6.RELEASE
Kotlin:1.3.41
代码在 IntellIJ 中运行良好 - 但在 eclipse 中我得到这些错误
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: @Configuration class 'SwaggerConfig' may not be final. Remove the final modifier to continue.
Offending resource: class path resource [com/kotlin/springboot/kotlindemo/config/SwaggerConfig.class]
这是 SwaggerConfig 类
@Configuration
@EnableSwagger2
class SwaggerConfig {
@Bean
fun api(): Docket = Docket(DocumentationType.SWAGGER_2)
.select()
.apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.boot")))
.build()
}
我的 pom.xml 文件中有以下插件设置
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<configuration>
<args>
<arg>-Xjsr305=strict</arg>
</args>
<compilerPlugins>
<plugin>spring</plugin>
</compilerPlugins>
</configuration>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-allopen</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
同样,在 IntelliJ 中一切正常,但在 eclipse 中不能正常工作有什么想法可以在 eclipse 中解决这个问题吗?
谢谢达米安
解决方案
我升级到最新版本的 kotlin 插件,这解决了我面临的问题。
推荐阅读
- r - 在 R 中查找多个模式的列表中元素的位置
- python - 在 OpenMaya 中获取顶点法线?
- android - 我怎样才能获得像 ColorOs、Flyme、LineageOS 等 Android 类型?
- react-native - 反应原生 | 钩子组件
- python - 如何基于单列将数据框着色为在整行中具有相同颜色的条件热图
- android - 使用 OnBackPressedDispatcher() 的 OnBackPressedCallback() 不起作用
- python - 从 Pandas 数据透视表框架中注释数据点
- shopware - Shopware 6 在店面搜索中包含属性
- ios - iPad Safari Ctrl+C 类似 Enter 的操作
- python - 构建后无法导入 caffe