Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoProxyRegistrar throws NullPointer on @kotlin.Metadata Annotation [SPR-15055] #19621

Closed
spring-issuemaster opened this issue Dec 26, 2016 · 2 comments

Comments

@spring-issuemaster
Copy link
Collaborator

commented Dec 26, 2016

Marvin Schramm opened SPR-15055 and commented

When using a simple spring boot application with both mixed Java And Kotlin files
The Kotlin Plugin seems to introduce a new Annotation for some classes. "@kotlin.Metadata"

When starting the Spring Boot Project the AutoProxyRegistrar.java#L63 is not able to resolve the
annotation metadata and will throw a NullPointerException.
In my case, this only happens when i use the @EnableCaching Annotation (i think when not using it, the AutoProxyRegistrar class is not invoked)

  1. Repository For This is here
    spring-projects/spring-framework-issues#145

Only those two classes and a single dependency is needed to reproduce this issue

@EnableCaching
@Configuration
open class CacheConfiguration {
    //this can be empty. when removing the @EnableCaching Annotation everything works
}
@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}
group = 'org.springframework.issues'
version = '1.0.0.SNAPSHOT'

buildscript {
    ext {
        kotlin_version = '1.0.5-2'
        springBootVersion = '1.4.3.RELEASE'
    }
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'kotlin'
apply plugin: 'org.springframework.boot'
apply plugin: 'idea'

repositories {
    maven { url 'http://repo.spring.io/snapshot' }
    mavenCentral()
}

dependencies {
    compile(group: 'org.springframework.boot', name: 'spring-boot-starter')
}

[compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all']

sourceCompatibility = 1.8
targetCompatibility = 1.8

P.S. I am sorry if this is more are Spring-Boot and not Spring Framework issue. It was not clear for me where I should report this issue.


Affects: 4.3.5, 5.0 M3

Reference URL: http://stackoverflow.com/questions/41334909/spring-boot-kotlin-autoproxyregistrar-causes-nullpointer-exception

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Dec 27, 2016

Sébastien Deleuze commented

Good catch, fixed on master and 4.3.x branches via this change.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Dec 27, 2016

Marvin Schramm commented

Nice! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.