Spring引导配置处理器在库/梯度子项目中不工作

Spring引导配置处理器在库/梯度子项目中不工作,spring,spring-boot,gradle,intellij-idea,kotlin,Spring,Spring Boot,Gradle,Intellij Idea,Kotlin,软件: 渐变5.5.1 科特林1.3.50 弹簧靴2.2.0.M5 我正在尝试在库中使用spring配置处理器。我有以下配置。 在父级build.gradle.kts中: subprojects { dependencies { implementation(platform(SpringBootPlugin.BOM_COORDINATES)) kapt(platform(SpringBootPlugin.BOM_COORDINATES)) } } 在子项目(相关

软件:

  • 渐变5.5.1
  • 科特林1.3.50
  • 弹簧靴2.2.0.M5

我正在尝试在库中使用spring配置处理器。我有以下配置。 在父级
build.gradle.kts
中:

subprojects {
  dependencies {
    implementation(platform(SpringBootPlugin.BOM_COORDINATES))
    kapt(platform(SpringBootPlugin.BOM_COORDINATES))
  }
}
在子项目(相关库)中:

application.yml
文件存在于
rootProject/subproject/src/main/resources
中,并且在其中定义了配置属性

IntelliJ显示了以下提示:

在类路径中找不到Spring引导配置注释处理器

并且
application.yml
中的配置与代码之间不存在链接(无ctrl+单击,无文档)

我在库的主@Configuration类中有这个:

@Configuration
@EnableWebSecurity
@EnableConfigurationProperties(SecurityConfigurationParameters::class)
class WebSecurityConfig(...) { ... }
这是properties类:

@ConfigurationProperties(prefix = "security")
class SecurityConfigurationParameters(
    @DefaultValue("false")
    val csrfEnabled: Boolean,
    @NestedConfigurationProperty
    val token: TokenConfig
)
application.yml
中有这样的内容:

security:
  csrf-enabled: true
  token.private-secret: ...
同样的设置也适用于独立应用程序

到目前为止,我怀疑问题在于这是一个库,但添加带有main函数的main类和
@SpringBootApplication
注释类并没有帮助。 我最后的怀疑是问题出在gradle或intellij的某个地方



编辑:我把范围缩小到IntelliJ。我看到kapt在
build/tmp/kapt3/classes/main/META-INF

中生成了元数据json,我可以向您指出,它似乎是相关的。但我从未使用过
kapt
myself@ThanksForAllTheFish这对我来说似乎是一个不同的问题,正如我在上面所说的,这个设置实际上在我的独立应用程序gradle项目中按预期工作,但在我的父/子项目中出现故障。让大家知道这个问题。有一个可复制的测试用例。是的,我正计划。
security:
  csrf-enabled: true
  token.private-secret: ...