I have a controller in micronaut
package com.mascix.controller;
import java.time.LocalDate;
import javax.ws.rs.core.Response;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import io.micronaut.core.annotation.Introspected;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
@Controller("/hello")
public class GreetController {
@Get
public Response hello() {
return Response.ok(new ApplicationInfo("micronaut", LocalDate.now().getYear())).build();
}
}
@Introspected
@JsonAutoDetect(fieldVisibility = Visibility.ANY)
class ApplicationInfo {
public ApplicationInfo(String string, int year) {
this.name = string;
this.releaseYear = year;
}
String name;
int releaseYear;
}
which is working fine when I ran from jar and response is
{"name":"micronaut","releaseYear":2022}
when I build the project with graalvm, it return empty json
{}
you can see the whole code here. there is no error or warning in logs. What am I missing ?