SpringCloud

作者: DragonRat | 来源:发表于2020-07-09 15:48 被阅读0次

创建方式
本地创建,maven依赖

<parent>
<groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
    <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> </dependency>
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope>
<exclusions>
<exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
  <build>
    <plugins>
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
    </plugins>
</build>

在线创建 :https://start.spring.io/

目录
src/main/java:存放代码
src/main/resources
static: 存放静态⽂文件,⽐比如 css、js、image, (访问⽅方式 http://localhost:8080/js/main.js) templates:存放静态⻚页⾯面jsp,html,tpl
config:存放配置⽂文件,application.properties
resources:同个⽂文件的加载顺序,静态资源⽂文件 Spring Boot 默认会挨个从META/resources > resources >static >public
⾥里里⾯面找是否存在相应的资源,如果有则直接返回,不不在默认加载的⽬目录,则找不不到 默认配置
spring.resources.static-locations = classpath:/META- INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/

相关文章

网友评论

    本文标题:SpringCloud

    本文链接:https://www.haomeiwen.com/subject/wqrscktx.html