Skip to content

Commit 3cc28ff

Browse files
committed
1 parent 9f3a2bc commit 3cc28ff

File tree

4 files changed

+22
-13
lines changed

4 files changed

+22
-13
lines changed

candy/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ java {
3939
}
4040

4141
nativeImage {
42-
args("-H:Name=candy", "-H:IncludeResources='./public/index.html'")
42+
args("-H:IncludeResources='./public/index.html'", "--report-unsupported-elements-at-runtime")
4343
}
4444

4545

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package candy;
2+
3+
import io.micronaut.core.annotation.Introspected;
4+
5+
@Introspected
6+
public record Message(
7+
Integer speed,
8+
String status,
9+
Boolean gimme
10+
){
11+
}

candy/src/main/java/candy/RequestController.java

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package candy;
22

3-
import candy.RequestController.Message;
4-
import io.micronaut.core.annotation.Introspected;
53
import io.micronaut.http.MediaType;
64
import io.micronaut.http.annotation.*;
75

@@ -12,14 +10,6 @@ public class RequestController {
1210
private static Integer speed = 0;
1311
private static Boolean gimme = Boolean.FALSE;
1412

15-
@Introspected
16-
public record Message(
17-
Integer speed,
18-
String status,
19-
Boolean gimme
20-
){
21-
}
22-
2313
@Get(uri="/candy", produces=MediaType.APPLICATION_JSON)
2414
public Message candy() {
2515
gimme = Boolean.TRUE;
@@ -34,13 +24,13 @@ public Message query() {
3424

3525
@Post(uri="/auto", consumes=MediaType.APPLICATION_JSON, produces=MediaType.TEXT_HTML)
3626
public void auto(Message message) {
37-
speed = message.speed;
27+
speed = message.speed();
3828
System.out.println(speed);
3929
}
4030

4131
@Post(uri="/whattodo", consumes=MediaType.APPLICATION_JSON, produces=MediaType.APPLICATION_JSON)
4232
public Message whattodo(Message message) {
43-
status = message.status;
33+
status = message.status();
4434
Message response = new Message(null, null, gimme);
4535
gimme = Boolean.TRUE;
4636
return response;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[ {
2+
"name" : "candy.Message",
3+
"allDeclaredConstructors" : true,
4+
"allDeclaredMethods" : true,
5+
"allDeclaredFields" : true,
6+
"allDeclaredClasses" : true
7+
}
8+
]

0 commit comments

Comments
 (0)