Skip to content

Spring Boot Dev Tools breaks Micronaut introspection #11599

@musketyr

Description

@musketyr

Adding Spring Boot Dev Tools may cause breaking Class.isInstanceof(Object) method which is for example used by Micronaut introspection.

The Grails 3 template should either not contain the Spring Boot Dev Tools as a dependency

or

There should be a warning (ideally inside the build.gradle file directly) to remove the dependency if the problem with introspection or any similar issue appears.

Steps to Reproduce

  1. Generate a new Grails 4 project
  2. Add dependency to micronaut-newrelic https://github.com/agorapulse/micronaut-newrelic
  3. Add dependency to grails-console https://plugins.grails.org/plugin/sheehan/console
  4. Create UserDigestInsightEvent event (see below)
  5. Run the application
  6. Run the script in the Grails console

UserDigestInsightEvent

class UserDigestInsightEvent implements NewRelicInsightsEvent {

    final String eventType = 'BarometerUserDigestEvent'

    Long userId
    String email
    String status

}

Test Script

ctx.newRelicInsightsService.createEvent(
    new UserDigestInsightEvent(userId: 1, email: "test", status: "TEST")
)

Expected Behaviour

The code is executed without any errors and logs the event into the console.

Actual Behaviour

Micronaut exception is thrown:

java.lang.IllegalArgumentException: Invalid bean [agorapulse.newrelic.UserDigestInsightEvent@3c3edaa8] for type: class agorapulse.newrelic.UserDigestInsightEvent
io.micronaut.core.beans.AbstractBeanProperty.get(AbstractBeanProperty.java:111)
com.agorapulse.micronaut.newrelic.BeanIntrospectionEventPayloadExtractor.lambda$extractPayload$1(BeanIntrospectionEventPayloadExtractor.java:46)
java.util.Optional.map(Optional.java:215)
com.agorapulse.micronaut.newrelic.BeanIntrospectionEventPayloadExtractor.extractPayload(BeanIntrospectionEventPayloadExtractor.java:46)
com.agorapulse.micronaut.newrelic.AsyncNewRelicInsightsService.createEvent(AsyncNewRelicInsightsService.java:51)
io.micronaut.context.AbstractExecutableMethod.invoke(AbstractExecutableMethod.java:147)
io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:60)
io.micronaut.validation.ValidatingInterceptor.intercept(ValidatingInterceptor.java:123)
io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:69)
Script1.run(Script1.groovy:12)

Environment Information

  • Operating System: Darwin 19.6.0
  • Grails Version: 4.0.1
  • Micronaut Version: 1.2.11
  • JDK Version: Java(TM) SE Runtime Environment (build 1.8.0_212-b10)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions