1 diff --git a/pom.xml b/pom.xml 2 index 8a3d6f1..2d0f914 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 @@ -434,4 +448,4 @@ 40 </profile> 41 </profiles> 42 43 -</project> 44 \ No newline at end of file 45 +</project> 46 diff --git a/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java b/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java 47 index ac6e150..491ec02 100644 48 --- a/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java 49 +++ b/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java 50 @@ -18,6 +18,8 @@ package org.springframework.samples.petclinic; 51 52 import org.springframework.boot.SpringApplication; 53 import org.springframework.boot.autoconfigure.SpringBootApplication; 54 +import org.springframework.boot.context.ApplicationPidFileWriter; 55 +import org.springframework.boot.context.event.ApplicationStartedEvent; 56 import org.springframework.context.annotation.ImportRuntimeHints; 57 58 /** 59 @@ -31,7 +33,13 @@ import org.springframework.context.annotation.ImportRuntimeHints; 60 public class PetClinicApplication { 61 62 public static void main(String[] args) { 63 - SpringApplication.run(PetClinicApplication.class, args); 64 + SpringApplication application = new SpringApplication(PetClinicApplication.class); 65 + ApplicationPidFileWriter pidWriter = new ApplicationPidFileWriter(); 66 + application.addListeners(pidWriter); 67 + long begin = System.currentTimeMillis(); 68 + application.run(args); 69 + long end = System.currentTimeMillis(); 70 + System.out.println("#### Booted and returned in " + (end - begin) + "ms"); 71 } 72 73 } 74 diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties 75 index 5d3eeed..404f06e 100644 76 --- a/src/main/resources/application.properties 77 +++ b/src/main/resources/application.properties 78 @@ -23,3 +23,7 @@ logging.level.org.springframework=INFO 79 80 # Maximum time static resources should be cached 81 spring.web.resources.cache.cachecontrol.max-age=12h 82 + 83 +management.endpoints.web.exposure.include=* 84 +management.endpoint.shutdown.enabled=true 85 +endpoints.shutdown.enabled=true