├── .gitignore
├── .mvn
└── wrapper
│ ├── maven-wrapper.jar
│ └── maven-wrapper.properties
├── README.md
├── benchmarks
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── example
│ ├── JarPath.java
│ ├── MyBenchmark.java
│ └── SimpleProcessLauncherState.java
├── demo-flux-context-indexer
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── example
│ │ └── DemoApplication.java
│ └── resources
│ └── application.properties
├── demo-flux-lazy-init
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── example
│ │ ├── DemoApplication.java
│ │ └── LazyInitBeanFactoryPostProcessor.java
│ └── resources
│ └── application.properties
├── demo-flux-thin-all
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── example
│ │ ├── DemoApplication.java
│ │ └── LazyInitBeanFactoryPostProcessor.java
│ └── resources
│ └── application.properties
├── demo-flux-thin
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── example
│ │ └── DemoApplication.java
│ └── resources
│ └── application.properties
├── demo-flux-without-hibernate-validator
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── example
│ │ └── DemoApplication.java
│ └── resources
│ └── application.properties
├── demo-flux-without-jackson
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── example
│ │ └── DemoApplication.java
│ └── resources
│ └── application.properties
├── demo-flux-without-logback
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── example
│ │ └── DemoApplication.java
│ └── resources
│ └── application.properties
├── demo-flux
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── example
│ │ └── DemoApplication.java
│ └── resources
│ └── application.properties
├── demo-web
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── example
│ │ └── DemoApplication.java
│ └── resources
│ └── application.properties
├── mvnw
├── mvnw.cmd
└── pom.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 | .sts4-cache
12 |
13 | ### IntelliJ IDEA ###
14 | .idea
15 | *.iws
16 | *.iml
17 | *.ipr
18 |
19 | ### NetBeans ###
20 | /nbproject/private/
21 | /build/
22 | /nbbuild/
23 | /dist/
24 | /nbdist/
25 | /.nb-gradle/
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bufferings/spring-boot-startup-mybench/fd1779d6886fc5d7b0f3bbb64dcfdea77bbb1be1/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # spring-boot-startup-mybench
2 |
3 | I watched a session which Dave presented at Spring One Platform 2018.
4 |
5 | https://springoneplatform.io/2018/sessions/how-fast-is-spring-
6 |
7 | Then I tried it by myself in this repo to understand his session.
8 |
9 | ## BlogPost
10 |
11 | https://dev.to/bufferings/lets-make-springboot-app-start-faster-k9m
12 |
13 | ## JDK
14 |
15 | I used JDK 11 and didn't check other versions.
16 |
17 | ```
18 | ❯ java --version
19 | openjdk 11.0.1 2018-10-16
20 | OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
21 | OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
22 | ```
23 |
24 | ## How to use
25 |
26 | ```
27 | ❯ ./mvnw clean package
28 | ❯ (cd benchmarks/; java -jar target/benchmarks.jar)
29 | ```
30 |
31 | Then it shows results.
32 |
--------------------------------------------------------------------------------
/benchmarks/pom.xml:
--------------------------------------------------------------------------------
1 |
31 |
32 |
34 | 4.0.0
35 |
36 | com.example
37 | benchmarks
38 | 1.0
39 | jar
40 |
41 | JMH benchmark sample: Java
42 |
43 |
47 |
48 |
49 |
50 | org.openjdk.jmh
51 | jmh-core
52 | ${jmh.version}
53 |
54 |
55 | org.openjdk.jmh
56 | jmh-generator-annprocess
57 | ${jmh.version}
58 | provided
59 |
60 |
61 |
62 |
63 | UTF-8
64 | 1.21
65 | 11
66 | benchmarks
67 |
68 |
69 |
70 |
71 |
72 | org.apache.maven.plugins
73 | maven-compiler-plugin
74 | 3.1
75 |
76 | ${javac.target}
77 | ${javac.target}
78 | ${javac.target}
79 |
80 |
81 |
82 | org.apache.maven.plugins
83 | maven-shade-plugin
84 | 2.2
85 |
86 |
87 | package
88 |
89 | shade
90 |
91 |
92 | ${uberjar.name}
93 |
94 |
95 | org.openjdk.jmh.Main
96 |
97 |
98 |
99 |
100 |
104 | *:*
105 |
106 | META-INF/*.SF
107 | META-INF/*.DSA
108 | META-INF/*.RSA
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
--------------------------------------------------------------------------------
/benchmarks/src/main/java/com/example/JarPath.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 |
6 | public enum JarPath {
7 | WEB("demo-web", "0.0.1-SNAPSHOT"),
8 | FLUX("demo-flux", "0.0.1-SNAPSHOT"),
9 | FLUX_WITH_CONTEXT_INDEXER("demo-flux-context-indexer", "0.0.1-SNAPSHOT"),
10 | FLUX_LAZY_INIT("demo-flux-lazy-init", "0.0.1-SNAPSHOT"),
11 | FLUX_WO_LOGBACK("demo-flux-without-logback", "0.0.1-SNAPSHOT"),
12 | FLUX_WO_JACKSON("demo-flux-without-jackson", "0.0.1-SNAPSHOT"),
13 | FLUX_WO_HIBERNATE_VALIDATOR("demo-flux-without-hibernate-validator", "0.0.1-SNAPSHOT"),
14 | FLUX_THIN("demo-flux-thin", "0.0.1-SNAPSHOT"),
15 | FLUX_THIN_ALL("demo-flux-thin-all", "0.0.1-SNAPSHOT");
16 |
17 | private String path;
18 |
19 | JarPath(String artifactId, String version) {
20 | try {
21 | path = new File("..").getAbsoluteFile().getCanonicalPath() + File.separator
22 | + artifactId + File.separator + "target" + File.separator + artifactId
23 | + "-" + version + ".jar";
24 | } catch (IOException e) {
25 | throw new IllegalStateException("Cannot find benchmarks", e);
26 | }
27 | }
28 |
29 | public String path() {
30 | return path;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/benchmarks/src/main/java/com/example/MyBenchmark.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.openjdk.jmh.annotations.Benchmark;
4 | import org.openjdk.jmh.annotations.BenchmarkMode;
5 | import org.openjdk.jmh.annotations.Fork;
6 | import org.openjdk.jmh.annotations.Level;
7 | import org.openjdk.jmh.annotations.Measurement;
8 | import org.openjdk.jmh.annotations.Mode;
9 | import org.openjdk.jmh.annotations.Setup;
10 | import org.openjdk.jmh.annotations.Warmup;
11 |
12 | @Measurement(iterations = 5)
13 | @Warmup(iterations = 1)
14 | @Fork(value = 2, warmups = 0)
15 | @BenchmarkMode(Mode.SingleShotTime)
16 | public class MyBenchmark {
17 |
18 | @Benchmark
19 | public void case01_FluxBaseline(FluxState state) throws Exception {
20 | state.run();
21 | }
22 |
23 | public static class FluxState extends SimpleProcessLauncherState {
24 | @Setup(Level.Trial)
25 | public void beforeBenchmark() {
26 | super.init(JarPath.FLUX.path());
27 | }
28 | }
29 |
30 | @Benchmark
31 | public void case02_Web(WebState state) throws Exception {
32 | state.run();
33 | }
34 |
35 | public static class WebState extends SimpleProcessLauncherState {
36 | @Setup(Level.Trial)
37 | public void beforeBenchmark() {
38 | super.init(JarPath.WEB.path());
39 | }
40 | }
41 |
42 | @Benchmark
43 | public void case03_WithContextIndexer(WithContextIndexerState state) throws Exception {
44 | state.run();
45 | }
46 |
47 | public static class WithContextIndexerState extends SimpleProcessLauncherState {
48 | @Setup(Level.Trial)
49 | public void beforeBenchmark() {
50 | super.init(JarPath.FLUX_WITH_CONTEXT_INDEXER.path());
51 | }
52 | }
53 |
54 | @Benchmark
55 | public void case04_WithLazyInit(WithLazyInitState state) throws Exception {
56 | state.run();
57 | }
58 |
59 | public static class WithLazyInitState extends SimpleProcessLauncherState {
60 | @Setup(Level.Trial)
61 | public void beforeBenchmark() {
62 | super.init(JarPath.FLUX_LAZY_INIT.path());
63 | }
64 | }
65 |
66 | @Benchmark
67 | public void case05_WithNoVerifyOption(WithNoVerifyOptionState state) throws Exception {
68 | state.run();
69 | }
70 |
71 | public static class WithNoVerifyOptionState extends SimpleProcessLauncherState {
72 | @Setup(Level.Trial)
73 | public void beforeBenchmark() {
74 | super.init(JarPath.FLUX.path(), "-noverify");
75 | }
76 | }
77 |
78 | @Benchmark
79 | public void case06_WithTieredStopAtLevel1Option(WithTieredStopAtLevel1OptionState state) throws Exception {
80 | state.run();
81 | }
82 |
83 | public static class WithTieredStopAtLevel1OptionState extends SimpleProcessLauncherState {
84 | @Setup(Level.Trial)
85 | public void beforeBenchmark() {
86 | super.init(JarPath.FLUX.path(), "-XX:TieredStopAtLevel=1");
87 | }
88 | }
89 |
90 | @Benchmark
91 | public void case07_WithSpringConfigLocationOption(WithSpringConfigLocationOptionState state) throws Exception {
92 | state.run();
93 | }
94 |
95 | public static class WithSpringConfigLocationOptionState extends SimpleProcessLauncherState {
96 | @Setup(Level.Trial)
97 | public void beforeBenchmark() {
98 | super.init(JarPath.FLUX.path(), "-Dspring.config.location=classpath:/application.properties");
99 | }
100 | }
101 |
102 | @Benchmark
103 | public void case08_WithJmxDisabledOption(WithJmxDisabledOptionState state) throws Exception {
104 | state.run();
105 | }
106 |
107 | public static class WithJmxDisabledOptionState extends SimpleProcessLauncherState {
108 | @Setup(Level.Trial)
109 | public void beforeBenchmark() {
110 | super.init(JarPath.FLUX.path(), "-Dspring.jmx.enabled=false");
111 | }
112 | }
113 |
114 | @Benchmark
115 | public void case09_WithoutLogback(WithoutLogbackState state) throws Exception {
116 | state.run();
117 | }
118 |
119 | public static class WithoutLogbackState extends SimpleProcessLauncherState {
120 | @Setup(Level.Trial)
121 | public void beforeBenchmark() {
122 | super.init(JarPath.FLUX_WO_LOGBACK.path());
123 | }
124 | }
125 |
126 | @Benchmark
127 | public void case10_WithoutJackson(WithoutJacksonState state) throws Exception {
128 | state.run();
129 | }
130 |
131 | public static class WithoutJacksonState extends SimpleProcessLauncherState {
132 | @Setup(Level.Trial)
133 | public void beforeBenchmark() {
134 | super.init(JarPath.FLUX_WO_JACKSON.path());
135 | }
136 | }
137 |
138 | @Benchmark
139 | public void case11_WithoutHibernateValidator(WithoutHibernateValidatorState state) throws Exception {
140 | state.run();
141 | }
142 |
143 | public static class WithoutHibernateValidatorState extends SimpleProcessLauncherState {
144 | @Setup(Level.Trial)
145 | public void beforeBenchmark() {
146 | super.init(JarPath.FLUX_WO_HIBERNATE_VALIDATOR.path());
147 | }
148 | }
149 |
150 |
151 | @Benchmark
152 | public void case12_WithAppCds(WithAppCdsState state) throws Exception {
153 | state.run();
154 | }
155 |
156 | public static class WithAppCdsState extends SimpleProcessLauncherState {
157 | @Setup(Level.Trial)
158 | public void beforeBenchmark() {
159 | super.initWithCds(JarPath.FLUX.path());
160 | }
161 | }
162 |
163 | @Benchmark
164 | public void case13_Exploded(ExplodedState state) throws Exception {
165 | state.run();
166 | }
167 |
168 | public static class ExplodedState extends SimpleProcessLauncherState {
169 | @Setup(Level.Trial)
170 | public void beforeBenchmark() {
171 | super.initThinJar(JarPath.FLUX_THIN.path());
172 | }
173 | }
174 |
175 | @Benchmark
176 | public void case14_ExplodedWithAppCds(ExplodedWithAppCdsState state) throws Exception {
177 | state.run();
178 | }
179 |
180 | public static class ExplodedWithAppCdsState extends SimpleProcessLauncherState {
181 | @Setup(Level.Trial)
182 | public void beforeBenchmark() {
183 | super.initThinJarWithCds(JarPath.FLUX_THIN.path());
184 | }
185 | }
186 |
187 | @Benchmark
188 | public void case15_AllApplied(AllAppliedState state) throws Exception {
189 | state.run();
190 | }
191 |
192 | public static class AllAppliedState extends SimpleProcessLauncherState {
193 | @Setup(Level.Trial)
194 | public void beforeBenchmark() {
195 | super.initThinJarWithCds(JarPath.FLUX_THIN_ALL.path(),
196 | "-noverify",
197 | "-XX:TieredStopAtLevel=1",
198 | "-Dspring.config.location=classpath:/application.properties",
199 | "-Dspring.jmx.enabled=false");
200 | }
201 | }
202 | }
203 |
--------------------------------------------------------------------------------
/benchmarks/src/main/java/com/example/SimpleProcessLauncherState.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016-2017 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.example;
17 |
18 | import org.openjdk.jmh.annotations.Level;
19 | import org.openjdk.jmh.annotations.Scope;
20 | import org.openjdk.jmh.annotations.State;
21 | import org.openjdk.jmh.annotations.TearDown;
22 |
23 | import java.io.BufferedReader;
24 | import java.io.File;
25 | import java.io.IOException;
26 | import java.io.InputStream;
27 | import java.io.InputStreamReader;
28 | import java.util.ArrayList;
29 | import java.util.Arrays;
30 | import java.util.List;
31 |
32 | @State(Scope.Benchmark)
33 | public abstract class SimpleProcessLauncherState {
34 |
35 | private File home = new File("target");
36 |
37 | private List args;
38 |
39 | private Process started;
40 |
41 | public void init(String jarPath, String... additionalArgs) {
42 | args = new ArrayList<>();
43 | args.addAll(Arrays.asList("java", "-Xmx128m", "-Djava.security.egd=file:/dev/./urandom", "-Dserver.port=0"));
44 | args.addAll(Arrays.asList(additionalArgs));
45 | args.addAll(Arrays.asList("-jar", jarPath));
46 | }
47 |
48 | public void initWithCds(String jarPath, String... additionalArgs) {
49 | args = new ArrayList<>();
50 | args.addAll(Arrays.asList("java", "-Xmx128m", "-Djava.security.egd=file:/dev/./urandom", "-Dserver.port=0"));
51 | args.addAll(Arrays.asList("-Xshare:on", "-XX:SharedArchiveFile=app.jsa"));
52 | args.addAll(Arrays.asList(additionalArgs));
53 | args.addAll(Arrays.asList("-jar", jarPath));
54 |
55 | generateCdsClassList(home, jarPath, "org.springframework.boot.loader.JarLauncher");
56 | generateCdsClassDataArchive(home, jarPath);
57 | }
58 |
59 | public void initThinJar(String thinJarPath, String... additionalArgs) {
60 | var classPath = generateThinJarClassPath(home, thinJarPath);
61 | var mainClass = "com.example.DemoApplication";
62 |
63 | args = new ArrayList<>();
64 | args.addAll(Arrays.asList("java", "-Xmx128m", "-Djava.security.egd=file:/dev/./urandom", "-Dserver.port=0"));
65 | args.addAll(Arrays.asList(additionalArgs));
66 | args.addAll(Arrays.asList("-cp", classPath, mainClass));
67 | }
68 |
69 | public void initThinJarWithCds(String thinJarPath, String... additionalArgs) {
70 | var classPath = generateThinJarClassPath(home, thinJarPath);
71 | var mainClass = "com.example.DemoApplication";
72 |
73 | args = new ArrayList<>();
74 | args.addAll(Arrays.asList("java", "-Xmx128m", "-Djava.security.egd=file:/dev/./urandom", "-Dserver.port=0"));
75 | args.addAll(Arrays.asList("-Xshare:on", "-XX:SharedArchiveFile=app.jsa"));
76 | args.addAll(Arrays.asList(additionalArgs));
77 | args.addAll(Arrays.asList("-cp", classPath, mainClass));
78 |
79 | generateCdsClassList(home, classPath, mainClass);
80 | generateCdsClassDataArchive(home, classPath);
81 | }
82 |
83 | public void run() throws Exception {
84 | var builder = new ProcessBuilder(args);
85 | builder.directory(home);
86 | builder.redirectErrorStream(true);
87 | started = builder.start();
88 | System.out.println(output(started.getInputStream(), "Started"));
89 | }
90 |
91 | @TearDown(Level.Iteration)
92 | public void afterIteration() throws Exception {
93 | if (started != null && started.isAlive()) {
94 | started.destroyForcibly().waitFor();
95 | }
96 | }
97 |
98 | private static String output(InputStream inputStream, String marker) throws IOException {
99 | var sb = new StringBuilder();
100 | var br = new BufferedReader(new InputStreamReader(inputStream));
101 | String line;
102 | while ((line = br.readLine()) != null && (marker == null || !line.contains(marker))) {
103 | sb.append(line).append(System.getProperty("line.separator"));
104 | }
105 | if (line != null) {
106 | sb.append(line).append(System.getProperty("line.separator"));
107 | }
108 | return sb.toString();
109 | }
110 |
111 | private static void generateCdsClassList(File home, String classPath, String mainClass) {
112 | try {
113 | var builder = new ProcessBuilder("java",
114 | "-Xshare:off", "-XX:DumpLoadedClassList=app.classlist", "-Dserver.port=0",
115 | "-cp", classPath, mainClass);
116 | builder.directory(home);
117 | builder.redirectErrorStream(true);
118 |
119 | var process = builder.start();
120 | System.out.println(output(process.getInputStream(), "Started"));
121 | process.destroyForcibly();
122 | } catch (Exception e) {
123 | throw new RuntimeException("Failed to generate CDS ClassList.", e);
124 | }
125 | }
126 |
127 | private static void generateCdsClassDataArchive(File home, String classPath) {
128 | try {
129 | var builder = new ProcessBuilder("java",
130 | "-Xshare:dump", "-XX:SharedClassListFile=app.classlist",
131 | "-XX:SharedArchiveFile=app.jsa", "-cp", classPath);
132 | builder.directory(home);
133 | builder.redirectErrorStream(true);
134 |
135 | var process = builder.start();
136 | System.out.println(output(process.getInputStream(), null));
137 | process.waitFor();
138 | } catch (Exception e) {
139 | throw new RuntimeException("Failed to generate CDS ClassDataArchive.", e);
140 | }
141 | }
142 |
143 | private static String generateThinJarClassPath(File home, String thinJarPath) {
144 | try {
145 | var builder = new ProcessBuilder("java", "-Dthin.classpath", "-jar", thinJarPath);
146 | builder.directory(home);
147 | builder.redirectErrorStream(true);
148 |
149 | var process = builder.start();
150 | String classPath = output(process.getInputStream(), null);
151 | process.destroyForcibly();
152 | return classPath;
153 | } catch (Exception e) {
154 | throw new RuntimeException("Failed to generate ThinJar classpath.", e);
155 | }
156 | }
157 | }
--------------------------------------------------------------------------------
/demo-flux-context-indexer/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo-flux-context-indexer
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo-flux-context-indexer
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.1.0.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 11
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-webflux
31 |
32 |
33 | org.springframework
34 | spring-context-indexer
35 | true
36 |
37 |
38 |
39 |
40 |
41 |
42 | org.springframework.boot
43 | spring-boot-maven-plugin
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/demo-flux-context-indexer/src/main/java/com/example/DemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | @SpringBootApplication
9 | @RestController
10 | public class DemoApplication {
11 |
12 | @GetMapping("/")
13 | public String home() {
14 | return "Hello";
15 | }
16 |
17 | public static void main(String[] args) {
18 | SpringApplication.run(DemoApplication.class, args);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/demo-flux-context-indexer/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bufferings/spring-boot-startup-mybench/fd1779d6886fc5d7b0f3bbb64dcfdea77bbb1be1/demo-flux-context-indexer/src/main/resources/application.properties
--------------------------------------------------------------------------------
/demo-flux-lazy-init/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo-flux-lazy-init
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo-flux-lazy-init
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.1.0.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 11
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-webflux
31 |
32 |
33 |
34 |
35 |
36 |
37 | org.springframework.boot
38 | spring-boot-maven-plugin
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/demo-flux-lazy-init/src/main/java/com/example/DemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | @SpringBootApplication
9 | @RestController
10 | public class DemoApplication {
11 |
12 | @GetMapping("/")
13 | public String home() {
14 | return "Hello";
15 | }
16 |
17 | public static void main(String[] args) {
18 | SpringApplication.run(DemoApplication.class, args);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/demo-flux-lazy-init/src/main/java/com/example/LazyInitBeanFactoryPostProcessor.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.springframework.beans.BeansException;
4 | import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
5 | import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | @Configuration
9 | public class LazyInitBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
10 | @Override
11 | public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
12 | for (String beanName : beanFactory.getBeanDefinitionNames()) {
13 | beanFactory.getBeanDefinition(beanName).setLazyInit(true);
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/demo-flux-lazy-init/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bufferings/spring-boot-startup-mybench/fd1779d6886fc5d7b0f3bbb64dcfdea77bbb1be1/demo-flux-lazy-init/src/main/resources/application.properties
--------------------------------------------------------------------------------
/demo-flux-thin-all/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo-flux-thin-all
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo-flux-thin-all
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.1.0.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 11
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-webflux
31 |
32 |
33 | spring-boot-starter-json
34 | org.springframework.boot
35 |
36 |
37 | hibernate-validator
38 | org.hibernate.validator
39 |
40 |
41 | spring-boot-starter-logging
42 | org.springframework.boot
43 |
44 |
45 |
46 |
47 | org.slf4j
48 | slf4j-jdk14
49 |
50 |
51 | org.springframework
52 | spring-context-indexer
53 | true
54 |
55 |
56 |
57 |
58 |
59 |
60 | org.springframework.boot
61 | spring-boot-maven-plugin
62 |
63 |
64 | org.springframework.boot.experimental
65 | spring-boot-thin-layout
66 | 1.0.15.RELEASE
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/demo-flux-thin-all/src/main/java/com/example/DemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | @SpringBootApplication
9 | @RestController
10 | public class DemoApplication {
11 |
12 | @GetMapping("/")
13 | public String home() {
14 | return "Hello";
15 | }
16 |
17 | public static void main(String[] args) {
18 | SpringApplication.run(DemoApplication.class, args);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/demo-flux-thin-all/src/main/java/com/example/LazyInitBeanFactoryPostProcessor.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.springframework.beans.BeansException;
4 | import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
5 | import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | @Configuration
9 | public class LazyInitBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
10 | @Override
11 | public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
12 | for (String beanName : beanFactory.getBeanDefinitionNames()) {
13 | beanFactory.getBeanDefinition(beanName).setLazyInit(true);
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/demo-flux-thin-all/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bufferings/spring-boot-startup-mybench/fd1779d6886fc5d7b0f3bbb64dcfdea77bbb1be1/demo-flux-thin-all/src/main/resources/application.properties
--------------------------------------------------------------------------------
/demo-flux-thin/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo-flux-thin
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo-flux-thin
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.1.0.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 11
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-webflux
31 |
32 |
33 |
34 |
35 |
36 |
37 | org.springframework.boot
38 | spring-boot-maven-plugin
39 |
40 |
41 | org.springframework.boot.experimental
42 | spring-boot-thin-layout
43 | 1.0.15.RELEASE
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/demo-flux-thin/src/main/java/com/example/DemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | @SpringBootApplication
9 | @RestController
10 | public class DemoApplication {
11 |
12 | @GetMapping("/")
13 | public String home() {
14 | return "Hello";
15 | }
16 |
17 | public static void main(String[] args) {
18 | SpringApplication.run(DemoApplication.class, args);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/demo-flux-thin/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bufferings/spring-boot-startup-mybench/fd1779d6886fc5d7b0f3bbb64dcfdea77bbb1be1/demo-flux-thin/src/main/resources/application.properties
--------------------------------------------------------------------------------
/demo-flux-without-hibernate-validator/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo-flux-without-hibernate-validator
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo-flux-without-hibernate-validator
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.1.0.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 11
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-webflux
31 |
32 |
33 | hibernate-validator
34 | org.hibernate.validator
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | org.springframework.boot
44 | spring-boot-maven-plugin
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/demo-flux-without-hibernate-validator/src/main/java/com/example/DemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | @SpringBootApplication
9 | @RestController
10 | public class DemoApplication {
11 |
12 | @GetMapping("/")
13 | public String home() {
14 | return "Hello";
15 | }
16 |
17 | public static void main(String[] args) {
18 | SpringApplication.run(DemoApplication.class, args);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/demo-flux-without-hibernate-validator/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bufferings/spring-boot-startup-mybench/fd1779d6886fc5d7b0f3bbb64dcfdea77bbb1be1/demo-flux-without-hibernate-validator/src/main/resources/application.properties
--------------------------------------------------------------------------------
/demo-flux-without-jackson/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo-flux-without-jackson
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo-flux-without-jackson
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.1.0.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 11
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-webflux
31 |
32 |
33 | spring-boot-starter-json
34 | org.springframework.boot
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | org.springframework.boot
44 | spring-boot-maven-plugin
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/demo-flux-without-jackson/src/main/java/com/example/DemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | @SpringBootApplication
9 | @RestController
10 | public class DemoApplication {
11 |
12 | @GetMapping("/")
13 | public String home() {
14 | return "Hello";
15 | }
16 |
17 | public static void main(String[] args) {
18 | SpringApplication.run(DemoApplication.class, args);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/demo-flux-without-jackson/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bufferings/spring-boot-startup-mybench/fd1779d6886fc5d7b0f3bbb64dcfdea77bbb1be1/demo-flux-without-jackson/src/main/resources/application.properties
--------------------------------------------------------------------------------
/demo-flux-without-logback/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo-flux-without-logback
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo-flux-without-logback
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.1.0.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 11
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-webflux
31 |
32 |
33 | spring-boot-starter-logging
34 | org.springframework.boot
35 |
36 |
37 |
38 |
39 | org.slf4j
40 | slf4j-jdk14
41 |
42 |
43 |
44 |
45 |
46 |
47 | org.springframework.boot
48 | spring-boot-maven-plugin
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/demo-flux-without-logback/src/main/java/com/example/DemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | @SpringBootApplication
9 | @RestController
10 | public class DemoApplication {
11 |
12 | @GetMapping("/")
13 | public String home() {
14 | return "Hello";
15 | }
16 |
17 | public static void main(String[] args) {
18 | SpringApplication.run(DemoApplication.class, args);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/demo-flux-without-logback/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bufferings/spring-boot-startup-mybench/fd1779d6886fc5d7b0f3bbb64dcfdea77bbb1be1/demo-flux-without-logback/src/main/resources/application.properties
--------------------------------------------------------------------------------
/demo-flux/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo-flux
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | demo-flux
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.1.0.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 11
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-webflux
31 |
32 |
33 |
34 |
35 |
36 |
37 | org.springframework.boot
38 | spring-boot-maven-plugin
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/demo-flux/src/main/java/com/example/DemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | @SpringBootApplication
9 | @RestController
10 | public class DemoApplication {
11 |
12 | @GetMapping("/")
13 | public String home() {
14 | return "Hello";
15 | }
16 |
17 | public static void main(String[] args) {
18 | SpringApplication.run(DemoApplication.class, args);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/demo-flux/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bufferings/spring-boot-startup-mybench/fd1779d6886fc5d7b0f3bbb64dcfdea77bbb1be1/demo-flux/src/main/resources/application.properties
--------------------------------------------------------------------------------
/demo-web/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo-web
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | deo-web
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.1.0.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 11
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-web
31 |
32 |
33 |
34 |
35 |
36 |
37 | org.springframework.boot
38 | spring-boot-maven-plugin
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/demo-web/src/main/java/com/example/DemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.web.bind.annotation.GetMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | @SpringBootApplication
9 | @RestController
10 | public class DemoApplication {
11 |
12 | @GetMapping("/")
13 | public String home() {
14 | return "Hello";
15 | }
16 |
17 | public static void main(String[] args) {
18 | SpringApplication.run(DemoApplication.class, args);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/demo-web/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bufferings/spring-boot-startup-mybench/fd1779d6886fc5d7b0f3bbb64dcfdea77bbb1be1/demo-web/src/main/resources/application.properties
--------------------------------------------------------------------------------
/mvnw:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # ----------------------------------------------------------------------------
3 | # Licensed to the Apache Software Foundation (ASF) under one
4 | # or more contributor license agreements. See the NOTICE file
5 | # distributed with this work for additional information
6 | # regarding copyright ownership. The ASF licenses this file
7 | # to you under the Apache License, Version 2.0 (the
8 | # "License"); you may not use this file except in compliance
9 | # with the License. You may obtain a copy of the License at
10 | #
11 | # http://www.apache.org/licenses/LICENSE-2.0
12 | #
13 | # Unless required by applicable law or agreed to in writing,
14 | # software distributed under the License is distributed on an
15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | # KIND, either express or implied. See the License for the
17 | # specific language governing permissions and limitations
18 | # under the License.
19 | # ----------------------------------------------------------------------------
20 |
21 | # ----------------------------------------------------------------------------
22 | # Maven2 Start Up Batch script
23 | #
24 | # Required ENV vars:
25 | # ------------------
26 | # JAVA_HOME - location of a JDK home dir
27 | #
28 | # Optional ENV vars
29 | # -----------------
30 | # M2_HOME - location of maven2's installed home dir
31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven
32 | # e.g. to debug Maven itself, use
33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files
35 | # ----------------------------------------------------------------------------
36 |
37 | if [ -z "$MAVEN_SKIP_RC" ] ; then
38 |
39 | if [ -f /etc/mavenrc ] ; then
40 | . /etc/mavenrc
41 | fi
42 |
43 | if [ -f "$HOME/.mavenrc" ] ; then
44 | . "$HOME/.mavenrc"
45 | fi
46 |
47 | fi
48 |
49 | # OS specific support. $var _must_ be set to either true or false.
50 | cygwin=false;
51 | darwin=false;
52 | mingw=false
53 | case "`uname`" in
54 | CYGWIN*) cygwin=true ;;
55 | MINGW*) mingw=true;;
56 | Darwin*) darwin=true
57 | #
58 | # Look for the Apple JDKs first to preserve the existing behaviour, and then look
59 | # for the new JDKs provided by Oracle.
60 | #
61 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
62 | #
63 | # Apple JDKs
64 | #
65 | export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
66 | fi
67 |
68 | if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
69 | #
70 | # Apple JDKs
71 | #
72 | export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
73 | fi
74 |
75 | if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
76 | #
77 | # Oracle JDKs
78 | #
79 | export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
80 | fi
81 |
82 | if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
83 | #
84 | # Apple JDKs
85 | #
86 | export JAVA_HOME=`/usr/libexec/java_home`
87 | fi
88 | ;;
89 | esac
90 |
91 | if [ -z "$JAVA_HOME" ] ; then
92 | if [ -r /etc/gentoo-release ] ; then
93 | JAVA_HOME=`java-config --jre-home`
94 | fi
95 | fi
96 |
97 | if [ -z "$M2_HOME" ] ; then
98 | ## resolve links - $0 may be a link to maven's home
99 | PRG="$0"
100 |
101 | # need this for relative symlinks
102 | while [ -h "$PRG" ] ; do
103 | ls=`ls -ld "$PRG"`
104 | link=`expr "$ls" : '.*-> \(.*\)$'`
105 | if expr "$link" : '/.*' > /dev/null; then
106 | PRG="$link"
107 | else
108 | PRG="`dirname "$PRG"`/$link"
109 | fi
110 | done
111 |
112 | saveddir=`pwd`
113 |
114 | M2_HOME=`dirname "$PRG"`/..
115 |
116 | # make it fully qualified
117 | M2_HOME=`cd "$M2_HOME" && pwd`
118 |
119 | cd "$saveddir"
120 | # echo Using m2 at $M2_HOME
121 | fi
122 |
123 | # For Cygwin, ensure paths are in UNIX format before anything is touched
124 | if $cygwin ; then
125 | [ -n "$M2_HOME" ] &&
126 | M2_HOME=`cygpath --unix "$M2_HOME"`
127 | [ -n "$JAVA_HOME" ] &&
128 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
129 | [ -n "$CLASSPATH" ] &&
130 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
131 | fi
132 |
133 | # For Migwn, ensure paths are in UNIX format before anything is touched
134 | if $mingw ; then
135 | [ -n "$M2_HOME" ] &&
136 | M2_HOME="`(cd "$M2_HOME"; pwd)`"
137 | [ -n "$JAVA_HOME" ] &&
138 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
139 | # TODO classpath?
140 | fi
141 |
142 | if [ -z "$JAVA_HOME" ]; then
143 | javaExecutable="`which javac`"
144 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
145 | # readlink(1) is not available as standard on Solaris 10.
146 | readLink=`which readlink`
147 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
148 | if $darwin ; then
149 | javaHome="`dirname \"$javaExecutable\"`"
150 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
151 | else
152 | javaExecutable="`readlink -f \"$javaExecutable\"`"
153 | fi
154 | javaHome="`dirname \"$javaExecutable\"`"
155 | javaHome=`expr "$javaHome" : '\(.*\)/bin'`
156 | JAVA_HOME="$javaHome"
157 | export JAVA_HOME
158 | fi
159 | fi
160 | fi
161 |
162 | if [ -z "$JAVACMD" ] ; then
163 | if [ -n "$JAVA_HOME" ] ; then
164 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
165 | # IBM's JDK on AIX uses strange locations for the executables
166 | JAVACMD="$JAVA_HOME/jre/sh/java"
167 | else
168 | JAVACMD="$JAVA_HOME/bin/java"
169 | fi
170 | else
171 | JAVACMD="`which java`"
172 | fi
173 | fi
174 |
175 | if [ ! -x "$JAVACMD" ] ; then
176 | echo "Error: JAVA_HOME is not defined correctly." >&2
177 | echo " We cannot execute $JAVACMD" >&2
178 | exit 1
179 | fi
180 |
181 | if [ -z "$JAVA_HOME" ] ; then
182 | echo "Warning: JAVA_HOME environment variable is not set."
183 | fi
184 |
185 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
186 |
187 | # For Cygwin, switch paths to Windows format before running java
188 | if $cygwin; then
189 | [ -n "$M2_HOME" ] &&
190 | M2_HOME=`cygpath --path --windows "$M2_HOME"`
191 | [ -n "$JAVA_HOME" ] &&
192 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
193 | [ -n "$CLASSPATH" ] &&
194 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
195 | fi
196 |
197 | # traverses directory structure from process work directory to filesystem root
198 | # first directory with .mvn subdirectory is considered project base directory
199 | find_maven_basedir() {
200 | local basedir=$(pwd)
201 | local wdir=$(pwd)
202 | while [ "$wdir" != '/' ] ; do
203 | if [ -d "$wdir"/.mvn ] ; then
204 | basedir=$wdir
205 | break
206 | fi
207 | wdir=$(cd "$wdir/.."; pwd)
208 | done
209 | echo "${basedir}"
210 | }
211 |
212 | # concatenates all lines of a file
213 | concat_lines() {
214 | if [ -f "$1" ]; then
215 | echo "$(tr -s '\n' ' ' < "$1")"
216 | fi
217 | }
218 |
219 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
220 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
221 |
222 | # Provide a "standardized" way to retrieve the CLI args that will
223 | # work with both Windows and non-Windows executions.
224 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
225 | export MAVEN_CMD_LINE_ARGS
226 |
227 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
228 |
229 | exec "$JAVACMD" \
230 | $MAVEN_OPTS \
231 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
232 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
233 | ${WRAPPER_LAUNCHER} "$@"
234 |
--------------------------------------------------------------------------------
/mvnw.cmd:
--------------------------------------------------------------------------------
1 | @REM ----------------------------------------------------------------------------
2 | @REM Licensed to the Apache Software Foundation (ASF) under one
3 | @REM or more contributor license agreements. See the NOTICE file
4 | @REM distributed with this work for additional information
5 | @REM regarding copyright ownership. The ASF licenses this file
6 | @REM to you under the Apache License, Version 2.0 (the
7 | @REM "License"); you may not use this file except in compliance
8 | @REM with the License. You may obtain a copy of the License at
9 | @REM
10 | @REM http://www.apache.org/licenses/LICENSE-2.0
11 | @REM
12 | @REM Unless required by applicable law or agreed to in writing,
13 | @REM software distributed under the License is distributed on an
14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | @REM KIND, either express or implied. See the License for the
16 | @REM specific language governing permissions and limitations
17 | @REM under the License.
18 | @REM ----------------------------------------------------------------------------
19 |
20 | @REM ----------------------------------------------------------------------------
21 | @REM Maven2 Start Up Batch script
22 | @REM
23 | @REM Required ENV vars:
24 | @REM JAVA_HOME - location of a JDK home dir
25 | @REM
26 | @REM Optional ENV vars
27 | @REM M2_HOME - location of maven2's installed home dir
28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
31 | @REM e.g. to debug Maven itself, use
32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
34 | @REM ----------------------------------------------------------------------------
35 |
36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
37 | @echo off
38 | @REM set title of command window
39 | title %0
40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
42 |
43 | @REM set %HOME% to equivalent of $HOME
44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
45 |
46 | @REM Execute a user defined script before this one
47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending
49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
51 | :skipRcPre
52 |
53 | @setlocal
54 |
55 | set ERROR_CODE=0
56 |
57 | @REM To isolate internal variables from possible post scripts, we use another setlocal
58 | @setlocal
59 |
60 | @REM ==== START VALIDATION ====
61 | if not "%JAVA_HOME%" == "" goto OkJHome
62 |
63 | echo.
64 | echo Error: JAVA_HOME not found in your environment. >&2
65 | echo Please set the JAVA_HOME variable in your environment to match the >&2
66 | echo location of your Java installation. >&2
67 | echo.
68 | goto error
69 |
70 | :OkJHome
71 | if exist "%JAVA_HOME%\bin\java.exe" goto init
72 |
73 | echo.
74 | echo Error: JAVA_HOME is set to an invalid directory. >&2
75 | echo JAVA_HOME = "%JAVA_HOME%" >&2
76 | echo Please set the JAVA_HOME variable in your environment to match the >&2
77 | echo location of your Java installation. >&2
78 | echo.
79 | goto error
80 |
81 | @REM ==== END VALIDATION ====
82 |
83 | :init
84 |
85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
86 | @REM Fallback to current working directory if not found.
87 |
88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
90 |
91 | set EXEC_DIR=%CD%
92 | set WDIR=%EXEC_DIR%
93 | :findBaseDir
94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound
95 | cd ..
96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound
97 | set WDIR=%CD%
98 | goto findBaseDir
99 |
100 | :baseDirFound
101 | set MAVEN_PROJECTBASEDIR=%WDIR%
102 | cd "%EXEC_DIR%"
103 | goto endDetectBaseDir
104 |
105 | :baseDirNotFound
106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
107 | cd "%EXEC_DIR%"
108 |
109 | :endDetectBaseDir
110 |
111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
112 |
113 | @setlocal EnableExtensions EnableDelayedExpansion
114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
116 |
117 | :endReadAdditionalConfig
118 |
119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
122 |
123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
126 | )
127 |
128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
130 | if exist %WRAPPER_JAR% (
131 | echo Found %WRAPPER_JAR%
132 | ) else (
133 | echo Couldn't find %WRAPPER_JAR%, downloading it ...
134 | echo Downloading from: %DOWNLOAD_URL%
135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
136 | echo Finished downloading %WRAPPER_JAR%
137 | )
138 | @REM End of extension
139 |
140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
141 | if ERRORLEVEL 1 goto error
142 | goto end
143 |
144 | :error
145 | set ERROR_CODE=1
146 |
147 | :end
148 | @endlocal & set ERROR_CODE=%ERROR_CODE%
149 |
150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending
152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
154 | :skipRcPost
155 |
156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause
158 |
159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
160 |
161 | exit /B %ERROR_CODE%
162 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | com.example
6 | spring-boot-startup-mybench
7 | 0.0.1-SNAPSHOT
8 | pom
9 | spring-boot-startup-mybench
10 |
11 |
12 | benchmarks
13 | demo-web
14 | demo-flux
15 | demo-flux-context-indexer
16 | demo-flux-lazy-init
17 | demo-flux-without-jackson
18 | demo-flux-without-logback
19 | demo-flux-without-hibernate-validator
20 | demo-flux-thin
21 | demo-flux-thin-all
22 |
23 |
24 |
--------------------------------------------------------------------------------