File tree Expand file tree Collapse file tree 8 files changed +10
-78
lines changed
data-redis-reactive/src/main/java/com/example/data/redis/reactive
quartz/src/main/java/com/example/quartz
java/com/example/resttemplate
resources/META-INF/native-image
webclient/src/main/java/com/example/webclient Expand file tree Collapse file tree 8 files changed +10
-78
lines changed Original file line number Diff line number Diff line change 1
1
package com .example .data .redis .reactive ;
2
2
3
- import com .example .data .redis .reactive .DataRedisReactiveApplication .PersonRuntimeHints ;
4
-
5
- import org .springframework .aot .hint .RuntimeHints ;
6
- import org .springframework .aot .hint .RuntimeHintsRegistrar ;
3
+ import org .springframework .aot .hint .annotation .RegisterReflectionForBinding ;
7
4
import org .springframework .aot .smoketest .thirdpartyhints .NettyRuntimeHints ;
8
5
import org .springframework .boot .SpringApplication ;
9
6
import org .springframework .boot .autoconfigure .SpringBootApplication ;
10
7
import org .springframework .context .annotation .ImportRuntimeHints ;
11
- import org .springframework .context .aot .BindingReflectionHintsRegistrar ;
12
8
13
9
@ SpringBootApplication
14
- @ ImportRuntimeHints ({ NettyRuntimeHints .class , PersonRuntimeHints .class })
10
+ @ ImportRuntimeHints (NettyRuntimeHints .class )
11
+ @ RegisterReflectionForBinding (Person .class )
15
12
public class DataRedisReactiveApplication {
16
13
17
14
public static void main (String [] args ) throws InterruptedException {
18
15
SpringApplication .run (DataRedisReactiveApplication .class , args );
19
16
Thread .currentThread ().join (); // To be able to measure memory consumption
20
17
}
21
18
22
- static class PersonRuntimeHints implements RuntimeHintsRegistrar {
23
-
24
- private final BindingReflectionHintsRegistrar bindingReflectionHintsRegistrar = new BindingReflectionHintsRegistrar ();
25
-
26
- @ Override
27
- public void registerHints (RuntimeHints hints , ClassLoader classLoader ) {
28
- this .bindingReflectionHintsRegistrar .registerReflectionHints (hints .reflection (), Person .class );
29
- }
30
-
31
- }
32
-
33
19
}
Original file line number Diff line number Diff line change 1
1
package com .example .quartz ;
2
2
3
- import java .util .function .Consumer ;
4
-
5
- import com .example .quartz .QuartzApplication .QuartzApplicationHints ;
6
-
7
- import org .springframework .aot .hint .MemberCategory ;
8
- import org .springframework .aot .hint .RuntimeHints ;
9
- import org .springframework .aot .hint .RuntimeHintsRegistrar ;
10
- import org .springframework .aot .hint .TypeHint .Builder ;
11
3
import org .springframework .boot .SpringApplication ;
12
4
import org .springframework .boot .autoconfigure .SpringBootApplication ;
13
- import org .springframework .context .annotation .ImportRuntimeHints ;
14
5
15
6
@ SpringBootApplication
16
- @ ImportRuntimeHints ({ QuartzApplicationHints .class })
17
7
public class QuartzApplication {
18
8
19
9
public static void main (String [] args ) throws InterruptedException {
20
10
SpringApplication .run (QuartzApplication .class , args );
21
11
Thread .currentThread ().join (); // To be able to measure memory consumption
22
12
}
23
13
24
- static class QuartzApplicationHints implements RuntimeHintsRegistrar {
25
-
26
- private static final Consumer <Builder > ALL_REFLECTION_HINTS = (builder ) -> builder .withMembers (
27
- MemberCategory .INVOKE_DECLARED_CONSTRUCTORS , MemberCategory .INVOKE_PUBLIC_METHODS ,
28
- MemberCategory .DECLARED_FIELDS );
29
-
30
- @ Override
31
- public void registerHints (RuntimeHints hints , ClassLoader classLoader ) {
32
- hints .reflection ().registerType (SimpleJob .class , ALL_REFLECTION_HINTS );
33
- }
34
-
35
- }
36
-
37
14
}
Original file line number Diff line number Diff line change 6
6
import org .quartz .Trigger ;
7
7
import org .quartz .TriggerBuilder ;
8
8
9
+ import org .springframework .aot .hint .annotation .RegisterReflectionForBinding ;
9
10
import org .springframework .context .annotation .Bean ;
10
11
import org .springframework .context .annotation .Configuration ;
11
12
12
13
@ Configuration
13
14
class QuartzConfiguration {
14
15
15
16
@ Bean
17
+ @ RegisterReflectionForBinding (SimpleJob .class )
16
18
public JobDetail simpleJobDetail () {
17
19
return JobBuilder .newJob (SimpleJob .class ).withIdentity ("simpleJob" ).usingJobData ("greeting" , "Hello world!" )
18
20
.storeDurably ().build ();
Original file line number Diff line number Diff line change 3
3
import java .net .URI ;
4
4
import java .time .Duration ;
5
5
6
- import com .example .resttemplate .DataDto .DataDtoRuntimeHints ;
7
-
6
+ import org .springframework .aot .hint .annotation .RegisterReflectionForBinding ;
8
7
import org .springframework .boot .CommandLineRunner ;
9
8
import org .springframework .boot .web .client .RestTemplateBuilder ;
10
- import org .springframework .context .annotation .ImportRuntimeHints ;
11
9
import org .springframework .stereotype .Component ;
12
10
import org .springframework .web .client .RestTemplate ;
13
11
14
12
@ Component
15
- @ ImportRuntimeHints ( DataDtoRuntimeHints .class )
13
+ @ RegisterReflectionForBinding ( DataDto .class )
16
14
class CLR implements CommandLineRunner {
17
15
18
16
private final RestTemplateBuilder restTemplateBuilder ;
Original file line number Diff line number Diff line change 1
1
package com .example .resttemplate ;
2
2
3
- import org .springframework .aot .hint .RuntimeHints ;
4
- import org .springframework .aot .hint .RuntimeHintsRegistrar ;
5
- import org .springframework .context .aot .BindingReflectionHintsRegistrar ;
6
-
7
3
public class DataDto {
8
4
9
5
private String url ;
@@ -34,15 +30,4 @@ public String toString() {
34
30
return "DataDto{" + "url='" + url + '\'' + ", method='" + method + '\'' + '}' ;
35
31
}
36
32
37
- static class DataDtoRuntimeHints implements RuntimeHintsRegistrar {
38
-
39
- private final BindingReflectionHintsRegistrar bindingReflectionHintsRegistrar = new BindingReflectionHintsRegistrar ();
40
-
41
- @ Override
42
- public void registerHints (RuntimeHints hints , ClassLoader classLoader ) {
43
- this .bindingReflectionHintsRegistrar .registerReflectionHints (hints .reflection (), DataDto .class );
44
- }
45
-
46
- }
47
-
48
33
}
Original file line number Diff line number Diff line change
1
+ Args = --enable-url-protocols =http,https
Original file line number Diff line number Diff line change 2
2
3
3
import java .time .Duration ;
4
4
5
- import com .example .webclient .DataDto .DataDtoRuntimeHints ;
6
-
5
+ import org .springframework .aot .hint .annotation .RegisterReflectionForBinding ;
7
6
import org .springframework .boot .CommandLineRunner ;
8
- import org .springframework .context .annotation .ImportRuntimeHints ;
9
7
import org .springframework .stereotype .Component ;
10
8
import org .springframework .web .reactive .function .client .WebClient ;
11
9
import org .springframework .web .reactive .function .client .WebClient .Builder ;
12
10
13
11
@ Component
14
- @ ImportRuntimeHints ( DataDtoRuntimeHints .class )
12
+ @ RegisterReflectionForBinding ( DataDto .class )
15
13
class CLR implements CommandLineRunner {
16
14
17
15
private final Builder webClientBuilder ;
Original file line number Diff line number Diff line change 1
1
package com .example .webclient ;
2
2
3
- import org .springframework .aot .hint .RuntimeHints ;
4
- import org .springframework .aot .hint .RuntimeHintsRegistrar ;
5
- import org .springframework .context .aot .BindingReflectionHintsRegistrar ;
6
-
7
3
public class DataDto {
8
4
9
5
private String url ;
@@ -34,15 +30,4 @@ public String toString() {
34
30
return "DataDto{" + "url='" + url + '\'' + ", method='" + method + '\'' + '}' ;
35
31
}
36
32
37
- static class DataDtoRuntimeHints implements RuntimeHintsRegistrar {
38
-
39
- private final BindingReflectionHintsRegistrar bindingReflectionHintsRegistrar = new BindingReflectionHintsRegistrar ();
40
-
41
- @ Override
42
- public void registerHints (RuntimeHints hints , ClassLoader classLoader ) {
43
- this .bindingReflectionHintsRegistrar .registerReflectionHints (hints .reflection (), DataDto .class );
44
- }
45
-
46
- }
47
-
48
33
}
You can’t perform that action at this time.
0 commit comments