Intellij Idea 搭建SpringBoot項目
https://gitee.com/583431183/SpringBoot
創建工程
- 解決 running temp/archetype1tmp 一直加載問題
-DarchetypeCatalog=internal
- IDEA Create Maven Project 卡在 Downloading plugins for …
在.m2中創建settings.xml文件
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
- 創建項目分類
- war包項目
- jar包項目
- 添加依賴
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
- spring-boot-starter-parent作用
在pom.xml中引入spring-boot-start-parent,它可以提供dependency management,也就是說依賴管理,引入以後在申明其它dependency的時候就不需要version了。 - spring-boot-starter-web作用
springweb 核心組件
靜態資源的訪問
Spring Boot默認提供靜態資源目錄位置需置於classpath下,目錄名需符合如下規則:
/static
/public
/resources
/META-INF/resources