spring boot로 배포하는 방법은 다음에 설명되어 있다. tomcat을 사용하는 경우의 배포 방식(war 배포)은 아래 문서를 참조하면 된다.


http://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html


container를 undertow + freemaker를 사용 않는 경우는 약간 달라서, 작성한다.


pom.xml


<packaging>jar</packaging>


...

        <dependency>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-starter-undertow</artifactId>

        </dependency>

        <dependency>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-starter-freemarker</artifactId>

        </dependency>

...        

        

jar를 패키징한 후, 해당 jar를 배포한 후, 아래와 같이 같이 실행(startup)한다.      

  

java -jar $JAR_FILE


종료는 kill 명령어를 이용한다.


kill $PID





그러면, 아래 로그s와 같이 graceful하게 종료가 된다. 



2015-05-20 17:27:16.694  INFO 18281 --- [       Thread-1] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2a7ed1f: startup date [Wed May 20 17:26:53 KST 2015]; root of context hierarchy

2015-05-20 17:27:16.695  INFO 18281 --- [       Thread-1] o.s.c.support.DefaultLifecycleProcessor  : Stopping beans in phase 0

2015-05-20 17:27:16.697  INFO 18281 --- [       Thread-1] o.s.b.a.e.ElasticsearchAutoConfiguration : Closing Elasticsearch client

2015-05-20 17:27:16.697  INFO 18281 --- [       Thread-1] org.elasticsearch.node                   : [Eternity] stopping ...

2015-05-20 17:27:16.699  INFO 18281 --- [       Thread-1] org.elasticsearch.node                   : [Eternity] stopped

2015-05-20 17:27:16.699  INFO 18281 --- [       Thread-1] org.elasticsearch.node                   : [Eternity] closing ...

2015-05-20 17:27:16.704  INFO 18281 --- [       Thread-1] org.elasticsearch.node                   : [Eternity] closed

2015-05-20 17:27:16.705 DEBUG 18281 --- [       Thread-1] o.s.b.a.e.jmx.EndpointMBeanExporter      : Unregistering JMX-exposed beans on shutdown

2015-05-20 17:27:16.706 DEBUG 18281 --- [       Thread-1] o.s.b.a.e.jmx.EndpointMBeanExporter      : Unregistering JMX-exposed beans

2015-05-20 17:27:16.706  INFO 18281 --- [       Thread-1] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

2015-05-20 17:27:16.740  INFO 18281 --- [       Thread-1] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'metricsExecutor'





Posted by '김용환'
,