1 diff --git a/pom.xml b/pom.xml 2 index 8a3d6f1..6d148ff 100644 3 --- a/pom.xml 4 +++ b/pom.xml 5 @@ -209,10 +209,12 @@ 6 </execution> 7 </executions> 8 </plugin> 9 +<!-- 10 <plugin> 11 <groupId>org.graalvm.buildtools</groupId> 12 <artifactId>native-maven-plugin</artifactId> 13 </plugin> 14 +--> 15 <plugin> 16 <groupId>org.springframework.boot</groupId> 17 <artifactId>spring-boot-maven-plugin</artifactId> 18 @@ -230,8 +232,20 @@ 19 <java.source>${java.version}</java.source> 20 <java.target>${java.version}</java.target> 21 </additionalProperties> 22 + <image> 23 + <builder>paketobuildpacks/builder:tiny</builder> 24 + <env> 25 + <BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE> 26 + </env> 27 + </image> 28 </configuration> 29 </execution> 30 + <execution> 31 + <id>process-aot</id> 32 + <goals> 33 + <goal>process-aot</goal> 34 + </goals> 35 + </execution> 36 </executions> 37 </plugin> 38 <plugin> 39 diff --git a/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java b/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java 40 index ac6e150..fe5c747 100644 41 --- a/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java 42 +++ b/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java 43 @@ -16,6 +16,9 @@ 44 45 package org.springframework.samples.petclinic; 46 47 +import java.lang.management.ManagementFactory; 48 +import java.lang.management.RuntimeMXBean; 49 + 50 import org.springframework.boot.SpringApplication; 51 import org.springframework.boot.autoconfigure.SpringBootApplication; 52 import org.springframework.context.annotation.ImportRuntimeHints; 53 @@ -31,7 +34,26 @@ import org.springframework.context.annotation.ImportRuntimeHints; 54 public class PetClinicApplication { 55 56 public static void main(String[] args) { 57 + long mainStart = System.currentTimeMillis(); 58 + RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean(); 59 + // This includes all the time spent inside the JVM before main() is reached 60 + // (since os::Posix::init is called and initial_time_count is initialized). 61 + long vmStart = runtimeMXBean.getStartTime(); 62 + long maxBeanOverHead = System.currentTimeMillis() - mainStart; 63 + 64 SpringApplication.run(PetClinicApplication.class, args); 65 + long end = System.currentTimeMillis(); 66 + Boolean quit = Boolean.getBoolean("autoQuit"); 67 + if (quit) { 68 + System.out.println("#### Booted and returned in " + (end - vmStart - maxBeanOverHead) + "ms"); 69 + System.out.println("#### (debug) mainStart = " + mainStart); 70 + System.out.println("#### (debug) vmStart = " + vmStart); 71 + System.out.println("#### (debug) before main (mainStart - vmStart) = " + (mainStart - vmStart)); 72 + System.out.println("#### (debug) maxBeanOverHead = " + maxBeanOverHead); 73 + System.out.println("#### (debug) end = " + end); 74 + System.exit(0); 75 + } 76 + 77 } 78 79 }