11.12 Spring開發環境以及第一個Spring程式
阿新 • • 發佈:2022-01-18
Spring開發環境搭建
Maven
專案的porm.xml
匯入Spring
依賴
關鍵依賴:
Spring
專案是基於Bean
的程式設計,所以:
<dependencies>
<!-- 測試相關依賴 -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.1.0</version>
<scope>test</scope>
</dependency>
<!-- 核心基礎依賴 -->
<!--Spring核心容器Core-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<!--Spring上下文依賴-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<!--Spring的Bean依賴-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<!--Spring的M層-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<!--日誌相關-->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</dependencies>
依賴小結:
Spring
相關:
核心
Core
依賴上下文
Context
依賴物件
Bean
依賴表現層
Expression
依賴
例項搭建Spring專案
使用
maven
建立Spring
專案匯入相關依賴
建立
Spring
配置檔案建立
Java
類
使用maven
建立Spring
專案
File--->project--->org.apache.maven下的webapp
匯入相關依賴: