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