Gradle Test Agent Spring Instrument


(Sharad Goyal) #1

I have the following configuration in my gradle files

<code>
configurations {
	  testAgent
}

dependencies {
    testAgent 		"org.springframework:spring-instrument:3.2.6.RELEASE"
}

// set JVM arguments for the test JVM(s)
test {
	jvmArgs "-javaagent:${configurations.testAgent.singleFile}"
}
</code>

but I am still getting the below exception when I ran my test cases

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.context.weaving.AspectJWeavingEnabler#0’: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘loadTimeWeaver’: Initialization of bean failed; nested exception is java.lang.IllegalStateException: ClassLoader [sun.misc.Launcher$AppClassLoader] does NOT provide an ‘addTransformer(ClassFileTransformer)’ method. Specify a custom LoadTimeWeaver or start your Java virtual machine with Spring’s agent: -javaagent:org.springframework.instrument.jar
at org.springframework.beans.factory.support

Please help