Skip to content

Commit

Permalink
외부 tomcat에 war 배포하도록 설정 추가함.
Browse files Browse the repository at this point in the history
  • Loading branch information
javajigi committed Oct 7, 2016
1 parent b049f29 commit 1dc84f8
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
8 changes: 6 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>net.slipp</groupId>
<artifactId>my-slipp</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<packaging>war</packaging>

<name>my-slipp</name>
<description>SLiPP QnA</description>
Expand Down Expand Up @@ -41,7 +41,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/net/slipp/MyWebInitializer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package net.slipp;

import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;

public class MyWebInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(MySlippApplication.class);
}
}
10 changes: 9 additions & 1 deletion src/main/java/net/slipp/web/HomeController.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
package net.slipp.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import net.slipp.domain.QuestionRepository;

@Controller
public class HomeController {
@Autowired
private QuestionRepository questionRepository;

@GetMapping("")
public String home() {
public String home(Model model) {
model.addAttribute("questions", questionRepository.findAll());
return "index";
}
}
24 changes: 4 additions & 20 deletions src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@
<div class="col-md-12 col-sm-12 col-lg-10 col-lg-offset-1">
<div class="panel panel-default qna-list">
<ul class="list">
{{#questions}}
<li>
<div class="wrap">
<div class="main">
<strong class="subject">
<a href="./qna/show.html">국내에서 Ruby on Rails와 Play가 활성화되기 힘든 이유는 뭘까?</a>
<a href="./qna/show.html">{{title}}</a>
</strong>
<div class="auth-info">
<i class="icon-add-comment"></i>
<span class="time">2016-01-15 18:47</span>
<a href="./user/profile.html" class="author">자바지기</a>
<a href="./user/profile.html" class="author">{{writer}}</a>
</div>
<div class="reply" title="댓글">
<i class="icon-reply"></i>
Expand All @@ -29,24 +30,7 @@
</div>
</div>
</li>
<li>
<div class="wrap">
<div class="main">
<strong class="subject">
<a href="./qna/show.html">runtime 에 reflect 발동 주체 객체가 뭔지 알 방법이 있을까요?</a>
</strong>
<div class="auth-info">
<i class="icon-add-comment"></i>
<span class="time">2016-01-05 18:47</span>
<a href="./user/profile.html" class="author">김문수</a>
</div>
<div class="reply" title="댓글">
<i class="icon-reply"></i>
<span class="point">12</span>
</div>
</div>
</div>
</li>
{{/questions}}
</ul>
<div class="row">
<div class="col-md-3"></div>
Expand Down

0 comments on commit 1dc84f8

Please sign in to comment.