File tree Expand file tree Collapse file tree 2 files changed +35
-38
lines changed
src/main/java/com/example/demo Expand file tree Collapse file tree 2 files changed +35
-38
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ package com .example .demo ;
1
2
2
- import com . example . demo . ApplicationConfiguration ;
3
+ import org . springframework . boot . ApplicationRunner ;
3
4
import org .springframework .boot .SpringApplication ;
5
+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
6
+ import org .springframework .context .annotation .Bean ;
7
+
8
+ import java .lang .foreign .Linker ;
9
+ import java .lang .foreign .SymbolLookup ;
10
+ import java .util .Map ;
11
+
12
+ @ SpringBootApplication
13
+ public class DemoApplication {
14
+
15
+ public static void main (String [] args ) {
16
+ SpringApplication .run (DemoApplication .class , args );
17
+ }
18
+
19
+ @ Bean
20
+ SymbolLookup symbolLookup () {
21
+ var nativeLinker = Linker .nativeLinker ();
22
+ var stdlibLookup = nativeLinker .defaultLookup ();
23
+ var loaderLookup = SymbolLookup .loaderLookup ();
24
+ return name -> loaderLookup .find (name ).or (() -> stdlibLookup .find (name ));
25
+ }
26
+
27
+ @ Bean
28
+ ApplicationRunner demo (Map <String , LanguageDemonstrationRunner > demos ) {
29
+ return _ -> demos .forEach ((_ , demo ) -> {
30
+ try {
31
+ demo .run ();
32
+ } //
33
+ catch (Throwable e ) {
34
+ throw new RuntimeException (e );
35
+ }
36
+ });
37
+ }
4
38
5
- void main (String [] args ) {
6
- SpringApplication .run (ApplicationConfiguration .class , args );
7
39
}
You can’t perform that action at this time.
0 commit comments