Skip to content

Commit 2f6693a

Browse files
committed
Setting springboot initial environment and create sample download web page
1 parent fe1a14f commit 2f6693a

File tree

5 files changed

+115
-0
lines changed

5 files changed

+115
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package root.applications;
2+
3+
import java.util.Arrays;
4+
5+
import org.springframework.boot.CommandLineRunner;
6+
import org.springframework.boot.SpringApplication;
7+
import org.springframework.boot.autoconfigure.SpringBootApplication;
8+
import org.springframework.context.ApplicationContext;
9+
import org.springframework.context.annotation.Bean;
10+
import org.springframework.context.annotation.ComponentScan;
11+
12+
import lombok.extern.slf4j.Slf4j;
13+
14+
@ComponentScan(basePackages = { "root.handler" })
15+
@Slf4j
16+
@SpringBootApplication
17+
public class Application {
18+
19+
public static void main(String[] args) {
20+
SpringApplication.run(Application.class, args);
21+
}
22+
23+
@Bean
24+
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
25+
return args -> {
26+
log.info("Let's inspect the beans provided by Spring Boot");
27+
28+
String[] beanNames = ctx.getBeanDefinitionNames();
29+
Arrays.sort(beanNames);
30+
for (String beanName : beanNames) {
31+
log.debug(beanName);
32+
}
33+
};
34+
}
35+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package root.configuration;
2+
3+
import javax.annotation.PostConstruct;
4+
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.context.ApplicationContext;
7+
import org.springframework.context.annotation.Configuration;
8+
import org.springframework.core.env.Environment;
9+
10+
11+
@Configuration
12+
public class AppConfiguration {
13+
14+
@Autowired
15+
private ApplicationContext context;
16+
17+
@Autowired
18+
private Environment env;
19+
20+
@PostConstruct
21+
public void init() {
22+
}
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package root.handler;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
import org.springframework.stereotype.Controller;
7+
import org.springframework.ui.Model;
8+
import org.springframework.web.bind.annotation.GetMapping;
9+
10+
@Controller
11+
public class HomeHandler {
12+
13+
@GetMapping(path = "/")
14+
public String home(Model model) {
15+
List<String> downloadLinks = new ArrayList<>();
16+
downloadLinks.add("https://DBMonitoring.co.kr/download/release-1.0.0");
17+
downloadLinks.add("https://DBMonitoring.co.kr/download/release-1.0.1");
18+
downloadLinks.add("https://DBMonitoring.co.kr/download/release-1.1.0");
19+
downloadLinks.add("https://DBMonitoring.co.kr/download/release-1.1.1");
20+
model.addAttribute("downloadLinks", downloadLinks);
21+
return "index";
22+
}
23+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
table {
2+
border-collapse: collapse;
3+
width: 100%;
4+
}
5+
6+
td, th {
7+
border: 1px solid #dddddd;
8+
text-align: center;
9+
padding: 8px;
10+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html xmlns:th="http://www.thymeleaf.org" lang="ko">
3+
<head>
4+
<meta charset="UTF-8">
5+
<link th:href="@{/css/home.css}" rel="stylesheet" type="text/css">
6+
<title>Home</title>
7+
</head>
8+
<body>
9+
<h1>DB Monitoring Program Download</h1>
10+
<table>
11+
<tbody>
12+
<tr>
13+
<th>Programs</th>
14+
</tr>
15+
<th:block th:each="downloadLink : ${downloadLinks}">
16+
<tr>
17+
<td><a th:href="@{${downloadLink}}"><span
18+
th:text="${downloadLink}"></span></a></td>
19+
</tr>
20+
</th:block>
21+
</tbody>
22+
</table>
23+
</body>
24+
</html>

0 commit comments

Comments
 (0)