title: Jackson does not find a property of a POJO in a Micronaut application compiled to a native image
body: <p>I've created a simple application with Micronaut 2.0.0: it was generated using Micronaut application generator here <a href="https://micronaut.io/launch/" rel="nofollow noreferrer">https://micronaut.io/launch/</a> , and then I added the following:</p>
  <pre><code>@Controller
  public class HelloController {
      @Get(&quot;/hello&quot;)
      public Result hello() {
          return new Result(&quot;Hello world!&quot;);
      }
  }
  
  public class Result {
      private final String message;
  
      public Result(String message) {
          this.message = message;
      }
  
      public String getMessage() {
          return message;
      }
  }
  </code></pre>
  <p>Then I build the application using <code>./mvnw clean package</code>.</p>
  <p>When I start it with <code>java -jar target/micronaut-minimal-1.0.jar</code>, it successfully starts. It responds correctly:</p>
  <pre><code>$ curl http://localhost:8080/hello
  {&quot;message&quot;:&quot;Hello world!&quot;}
  </code></pre>
  <p>Now I build a native image:</p>
  <pre><code>native-image -jar target/micronaut-minimal-0.1.jar target/app
  </code></pre>
  <p>Then I run it:</p>
  <pre><code>target/app
  </code></pre>
  <p>It starts OK.</p>
  <p>And now the same request produces an error:</p>
  <pre><code>$ curl http://localhost:8080/hello
  {&quot;message&quot;:&quot;Internal Server Error: Error encoding object [com.example.Result@7f21a9858b70] to JSON: No serializer found for class com.example.Result and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)&quot;}
  </code></pre>
  <p>I tried adding <code>@JsonProperty</code> to the <code>message</code> field or <code>getMessage()</code> method (with or without <code>value</code> attribute), to no avail.</p>
  <p>I believe that has something to do with the fact that reflection is probably not available in a native image. But how do I solve this issue?</p>
  <p>I'm using GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02) for both running and building the jar and image.</p>