ソースを参照

configure maven repository, configure database,add some test files.

171870002 5 年 前
コミット
d097d6f14f

+ 7 - 1
pom.xml

@@ -21,25 +21,31 @@
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-jdbc</artifactId>
 		</dependency>
+		<!--thymeleaf模板引擎配置-->
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-thymeleaf</artifactId>
 		</dependency>
+
+		<!--web依赖-->
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-web</artifactId>
 		</dependency>
+
+		<!--mybatis配置-->
 		<dependency>
 			<groupId>org.mybatis.spring.boot</groupId>
 			<artifactId>mybatis-spring-boot-starter</artifactId>
 			<version>2.1.4</version>
 		</dependency>
-
+<!--mysql数据库配置-->
 		<dependency>
 			<groupId>mysql</groupId>
 			<artifactId>mysql-connector-java</artifactId>
 			<scope>runtime</scope>
 		</dependency>
+<!--单元测试配置-->
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-test</artifactId>

+ 12 - 0
src/main/java/com/example/demo/controller/HelloController.java

@@ -0,0 +1,12 @@
+package com.example.demo.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Controller
+public class HelloController {
+    @RequestMapping("/index")
+    public String sayHello(){
+        return "index";
+    }
+}

+ 0 - 1
src/main/resources/application.properties

@@ -1 +0,0 @@
-

+ 7 - 0
src/main/resources/application.yml

@@ -0,0 +1,7 @@
+spring:
+  datasource:
+    name: data_structure_service  #数据库名
+    url: jdbc:mysql://localhost:3306/data_structure_service #url
+    username: root  #用户名
+    password: 123456  #密码
+    driver-class-name: com.mysql.cj.jdbc.Driver #数据库链接驱动

+ 10 - 0
src/main/resources/templates/index.html

@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>hello</title>
+</head>
+<body>
+    你好!初学者,我是简单spring boot启动页面。
+</body>
+</html>