一、Web

1. 依赖

  1. <dependencies>
  2. <dependency>
  3. <groupId>junit</groupId>
  4. <artifactId>junit</artifactId>
  5. <version>4.11</version>
  6. <scope>test</scope>
  7. </dependency>
  8. <!--web 开发-->
  9. <dependency>
  10. <groupId>org.springframework.boot</groupId>
  11. <artifactId>spring-boot-starter-web</artifactId>
  12. </dependency>
  13. <!--thymeleaf 依赖-->
  14. <dependency>
  15. <groupId>org.springframework.boot</groupId>
  16. <artifactId>spring-boot-starter-thymeleaf</artifactId>
  17. </dependency>
  18. <!--依赖entity工程-->
  19. <dependency>
  20. <groupId>com.yixuexi</groupId>
  21. <artifactId>atcrowdfunding09_member_entity</artifactId>
  22. <version>1.0-SNAPSHOT</version>
  23. </dependency>
  24. <!--注册中心-->
  25. <dependency>
  26. <groupId>org.springframework.cloud</groupId>
  27. <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
  28. </dependency>
  29. <!--热部署-->
  30. <dependency>
  31. <groupId>org.springframework.boot</groupId>
  32. <artifactId>spring-boot-devtools</artifactId>
  33. <optional>true</optional>
  34. </dependency>
  35. <!--依赖 api-->
  36. <dependency>
  37. <groupId>com.yixuexi</groupId>
  38. <artifactId>atcrowdfunding17_member_api</artifactId>
  39. <version>1.0-SNAPSHOT</version>
  40. </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文件下放静态资源
未命名图片.png
调整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">