一、Web
1. 依赖
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!--web 开发-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--thymeleaf 依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!--依赖entity工程-->
<dependency>
<groupId>com.yixuexi</groupId>
<artifactId>atcrowdfunding09_member_entity</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!--注册中心-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<!--热部署-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<!--依赖 api-->
<dependency>
<groupId>com.yixuexi</groupId>
<artifactId>atcrowdfunding17_member_api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
热部署maven插件 热部署文档: https://blog.csdn.net/chachapaofan/article/details/88697452
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
2. 主启动类
@SpringBootApplication
public class CrowdMainClass {
public static void main(String[] args) {
SpringApplication.run(CrowdMainClass.class);
}
}
3. application.yml
spring:
application:
name: yixuexi-crowd-auth
thymeleaf:
prefix: classpath:/templates/
suffix: .html
cache: false
eureka:
client:
serviceUrl:
defaultZone: http://localhost:1000/eureka/
server:
port: 4000
spring boot 要求在static文件下放静态资源
调整protal.html页面
添加 添加
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<base href="" th:href="@{/}">
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/carousel.css">