# spring-terminator **Repository Path**: dwarfeng/spring-terminator ## Basic Information - **Project Name**: spring-terminator - **Description**: Provides a terminator bean which can terminate the application gracefully. - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2020-03-14 - **Last Updated**: 2024-11-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # spring-terminator 一款基于Spring框架的优雅的程序终止器。 ## maven坐标 ```xml com.dwarfeng spring-terminator 1.0.7.a ``` ## 使用方式 1. 在Spring中添加如下配置。 ```xml ``` 2. 使用`ApplicationUtil.launch`方法启动程序。 ```java public static void main(String[] args) { ApplicationUtil.launch("classpath:spring/application-context*.xml"); } ``` 3. 在bean中注入`Terminal`对象,随时随地,优雅的关闭程序。 ```java @Component public static class ProgramKiller { @Autowired private Terminator terminator; @Override public void exit() { terminator.exit(10); } } ```