Spring Boot + Kotlin AutoProxyRegistrar вызывает исключение Nullpointer

Привет всем, я пытаюсь перенести небольшой проект весеннего ботинка с java 8 на kotlin. Я столкнулся с проблемой, когда у меня есть следующий класс конфигурации

@EnableCaching @Configuration open class CacheConfiguration : CachingConfigurer { @Bean override fun cacheManager(): CacheManager { return ConcurrentMapCacheManager() } @Bean override fun cacheResolver(): CacheResolver { return SimpleCacheResolver(cacheManager()) } /** * Simple Key Generator * @return not null */ @Bean override fun keyGenerator(): KeyGenerator { return SimpleKeyGenerator() } @Bean override fun errorHandler(): CacheErrorHandler { return SimpleCacheErrorHandler() } } 

Это фактический класс. Это буквально первый и единственный класс kotlin в моем проекте. Запуск проекта теперь с помощью gradle bootRun приводит к исключению Nullpointer в

 AutoProxyRegistrar.java#L63 AnnotationAttributes candidate = AnnotationConfigUtils.attributesFor(importingClassMetadata, annoType); Object mode = candidate.get("mode"); <-- candidate is null 

Он пытается получить атрибуты аннотаций, что хорошо работает для 2 аннотаций, которые я предоставил

 @EnableCaching @Configuration 

Хотя кажется, что kotlin добавляет новую аннотацию, называемую kotlin.Metadata, которая, по-видимому, не может быть обработана.

build.gradle

 buildscript { ext { ext.kotlin_version = '1.0.5-2' springBootVersion = '1.4.3.RELEASE' asciiDoctorVersion = '1.5.2' snippetsDir = file('build/generated-snippets') } repositories { jcenter() mavenCentral() maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") classpath("org.asciidoctor:asciidoctor-gradle-plugin:${asciiDoctorVersion}") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}") } } apply plugin: 'java' apply plugin: 'spring-boot' apply plugin: 'kotlin' apply plugin: 'org.asciidoctor.convert' sourceCompatibility = 1.8 targetCompatibility = 1.8 repositories { jcenter() mavenCentral() maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } } task wrapper(type: Wrapper) { gradleVersion = '2.14' } test { outputs.dir snippetsDir testLogging { events "passed", "skipped", "failed", "standardError" } } task stage { dependsOn build } asciidoctor { attributes 'snippets': snippetsDir inputs.dir snippetsDir dependsOn test } // Force ./gradlew cleanTest allprojects { tasks.matching { task -> task.name == "test" }.all { outputs.upToDateWhen { false } } } dependencies { compile(group: 'org.springframework.boot', name: 'spring-boot-starter') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-web') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-actuator') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-security') compile(group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: '2.0.10.RELEASE') compile(group: 'org.springframework.security', name: 'spring-security-jwt', version: '1.0.4.RELEASE') compile(group: 'org.postgresql', name: 'postgresql', version: '9.4.1209.jre7') testCompile(group: 'com.jayway.restassured', name: 'rest-assured', version: '2.9.0') testCompile(group: 'org.springframework.boot', name: 'spring-boot-starter-test') } к buildscript { ext { ext.kotlin_version = '1.0.5-2' springBootVersion = '1.4.3.RELEASE' asciiDoctorVersion = '1.5.2' snippetsDir = file('build/generated-snippets') } repositories { jcenter() mavenCentral() maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") classpath("org.asciidoctor:asciidoctor-gradle-plugin:${asciiDoctorVersion}") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}") } } apply plugin: 'java' apply plugin: 'spring-boot' apply plugin: 'kotlin' apply plugin: 'org.asciidoctor.convert' sourceCompatibility = 1.8 targetCompatibility = 1.8 repositories { jcenter() mavenCentral() maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } } task wrapper(type: Wrapper) { gradleVersion = '2.14' } test { outputs.dir snippetsDir testLogging { events "passed", "skipped", "failed", "standardError" } } task stage { dependsOn build } asciidoctor { attributes 'snippets': snippetsDir inputs.dir snippetsDir dependsOn test } // Force ./gradlew cleanTest allprojects { tasks.matching { task -> task.name == "test" }.all { outputs.upToDateWhen { false } } } dependencies { compile(group: 'org.springframework.boot', name: 'spring-boot-starter') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-web') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-actuator') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-security') compile(group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: '2.0.10.RELEASE') compile(group: 'org.springframework.security', name: 'spring-security-jwt', version: '1.0.4.RELEASE') compile(group: 'org.postgresql', name: 'postgresql', version: '9.4.1209.jre7') testCompile(group: 'com.jayway.restassured', name: 'rest-assured', version: '2.9.0') testCompile(group: 'org.springframework.boot', name: 'spring-boot-starter-test') } к buildscript { ext { ext.kotlin_version = '1.0.5-2' springBootVersion = '1.4.3.RELEASE' asciiDoctorVersion = '1.5.2' snippetsDir = file('build/generated-snippets') } repositories { jcenter() mavenCentral() maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") classpath("org.asciidoctor:asciidoctor-gradle-plugin:${asciiDoctorVersion}") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}") } } apply plugin: 'java' apply plugin: 'spring-boot' apply plugin: 'kotlin' apply plugin: 'org.asciidoctor.convert' sourceCompatibility = 1.8 targetCompatibility = 1.8 repositories { jcenter() mavenCentral() maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } } task wrapper(type: Wrapper) { gradleVersion = '2.14' } test { outputs.dir snippetsDir testLogging { events "passed", "skipped", "failed", "standardError" } } task stage { dependsOn build } asciidoctor { attributes 'snippets': snippetsDir inputs.dir snippetsDir dependsOn test } // Force ./gradlew cleanTest allprojects { tasks.matching { task -> task.name == "test" }.all { outputs.upToDateWhen { false } } } dependencies { compile(group: 'org.springframework.boot', name: 'spring-boot-starter') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-web') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-actuator') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-security') compile(group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: '2.0.10.RELEASE') compile(group: 'org.springframework.security', name: 'spring-security-jwt', version: '1.0.4.RELEASE') compile(group: 'org.postgresql', name: 'postgresql', version: '9.4.1209.jre7') testCompile(group: 'com.jayway.restassured', name: 'rest-assured', version: '2.9.0') testCompile(group: 'org.springframework.boot', name: 'spring-boot-starter-test') } к buildscript { ext { ext.kotlin_version = '1.0.5-2' springBootVersion = '1.4.3.RELEASE' asciiDoctorVersion = '1.5.2' snippetsDir = file('build/generated-snippets') } repositories { jcenter() mavenCentral() maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") classpath("org.asciidoctor:asciidoctor-gradle-plugin:${asciiDoctorVersion}") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}") } } apply plugin: 'java' apply plugin: 'spring-boot' apply plugin: 'kotlin' apply plugin: 'org.asciidoctor.convert' sourceCompatibility = 1.8 targetCompatibility = 1.8 repositories { jcenter() mavenCentral() maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } } task wrapper(type: Wrapper) { gradleVersion = '2.14' } test { outputs.dir snippetsDir testLogging { events "passed", "skipped", "failed", "standardError" } } task stage { dependsOn build } asciidoctor { attributes 'snippets': snippetsDir inputs.dir snippetsDir dependsOn test } // Force ./gradlew cleanTest allprojects { tasks.matching { task -> task.name == "test" }.all { outputs.upToDateWhen { false } } } dependencies { compile(group: 'org.springframework.boot', name: 'spring-boot-starter') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-web') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-actuator') compile(group: 'org.springframework.boot', name: 'spring-boot-starter-security') compile(group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: '2.0.10.RELEASE') compile(group: 'org.springframework.security', name: 'spring-security-jwt', version: '1.0.4.RELEASE') compile(group: 'org.postgresql', name: 'postgresql', version: '9.4.1209.jre7') testCompile(group: 'com.jayway.restassured', name: 'rest-assured', version: '2.9.0') testCompile(group: 'org.springframework.boot', name: 'spring-boot-starter-test') } 

Воспроизводимый образец

Я создал небольшой репозиторий для воспроизведения этой проблемы. https://github.com/spring-projects/spring-framework-issues/pull/145 И это https://jira.spring.io/browse/SPR-15055

    Это была настоящая ошибка, которая была исправлена ​​здесь https://jira.spring.io/browse/SPR-15055