Maven構建SpringBoot專案
目的:
構建一個Spring Boot專案,並實現一個簡單的Http請求處理
瞭解Spring Boot專案建立,執行過程,專案結構,簡單、開發快速的特性
Spring Boot 的優點:
1,開發者快速入門
2,開箱即用(自帶各種預設配置,簡化專案配置項)
3,無冗餘程式碼生成和XML配置檔案
建立SpringBoot專案
檢視專案
使用idea,匯入Maven專案,專案結構如下:
引入Web模組
新建工程的pom.xml,引入了2個依賴模組
spring-boot-starter:核心模組,包括自動配置支援、日誌和YAML
spring-boot-starter-test:測試模組,包括JUnit、Hamcrest、Mockito
需要引入Web模組 : pring-boot-starter-web
<dependencies>
<!-- 核心模組,包括自動配置支援、日誌和YAML -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- 測試模組,包括JUnit、Hamcrest、Mockito -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- 引入Web模組 -->
<dependency>
<groupId>org.springframework.boot</groupId >
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
新增spring-boot-starter-web配置後,執行maven->Reimport,下載模組檔案
新增spring-boot-starter-web後,專案支援web註解,如
@RestController,
@RequestMapping("/hello")
新增HelloWord服務
啟動主程式
Web專案建立完成
程式碼下載
相關推薦
利用Maven構建SpringBoot專案時@SpringBootApplication無法解析為型別
問題應該出在pom.xml檔案中,就是下面這段配置中的版本不對 <parent> <groupId>org.springframework.boot</groupId> <artifactI
Maven構建SpringBoot專案
目的: 構建一個Spring Boot專案,並實現一個簡單的Http請求處理 瞭解Spring Boot專案建立,執行過程,專案結構,簡單、開發快速的特性 Spring Boot 的優點: 1,開發者快速入門 2,開箱即用(自帶各種預設配置,簡化
使用Maven外掛構建SpringBoot專案,生成Docker映象push到DockerHub上
一個用於構建和推送Docker映象的Maven外掛。 使用Maven外掛構建Docker映象,將Docker映象push到DockerHub上,或者私有倉庫,上一篇文章是手寫Dockerfile,這篇文章藉助開源外掛docker-maven-plugin 進行
Maven外掛構建Springboot專案,生成Docker映象
一.Window平臺 .使用標準Spring Boot應用程式的Maven配置,建立springboot專案並測試。 新增Dockerfile:在src/main/resources下新增Dockerfile FROM java MAINTAINER "xiaoming
linux伺服器中Jenkins整合git、Gradle持續構建Springboot專案
Jenkins是用java編寫的開源持續整合工具,目前被國內外各公司廣泛使用。本章教大家如何在linux伺服器中使用Jenkins自動釋出一個可作為linux服務釋出的Springboot專案。 自動構建需要經過如下步驟:從git倉庫下載程式碼、使用Gradle進行構建、使用SSH推送到另
maven 釋出springboot專案
1.把Spring Boot打包成JAR的形式,需要在pom.xml檔案對應以下程式碼 <build> <finalName>ljl</finalName> //打包後.jar檔名 <plugins> <plugin>
基於Maven構建Web專案
1.下載Maven,並配置好環境變數 2.開啟命令列視窗,輸入以下命令構建Maven Web專案 mvn archetype:generate -DgroupId=com.hello -DartifactId=HelloWorld -DarchetypeArtifactId=maven-archetype
使用maven構建springboot
文章目錄 一、spring-boot-starter-parent的作用 二、不要parent的構建springboot專案 三、參考 一、spring-boot-starter-parent的作用 怎樣使用spring-boot
用sts通過maven打包springboot專案
1.點選windows——>preference——>java——>INSTALLED JREs,檢視右邊的內容,如果是jre,就將其改為jdk。否則打包編譯時會報No compiler is provided in this environment. Perhaps you ar
Eclipse下用maven構建Struts專案,實現簡單的登入及驗證。
點選File->new->Maven Project. 右鍵所建立的專案->點選Properties->點選Java Build Path將JDK改成所需要的版本 然後點選Project Facets先改Java,再改Dynamic Web Mod
從零構建springboot專案二:不使用 spring-boot-starter-parent 方式
Not everyone likes inheriting from the spring-boot-starter-parent POM. You may have your own corporate standard parent that you need to us
eclipse+maven搭建springboot專案入門
開始建立maven專案 選單 -> File -> New -> Other -> Maven -> Maven -> Maven Project -> New Maven Project 勾上這個 Create a s
MyEclipse2015構建使用Maven構建web專案
3.MyEclipse2015建立web專案後執行clean命令後,Maven執行報錯:-Dmaven.multiModuleProjectDirectory system propery is not set.,參考https://blog.csdn.net/lim
基於Maven的SpringBoot專案實現熱部署的兩種方式
前言 JRebel是JavaEE中比較流行的熱部署外掛,可快速實現熱部署,節省了大量重啟時間,提高了個人開發效率。看一張圖就知道了: 我這裡提到JRebel的目的主要是說明熱部署工具帶來的優勢:節省時間,提高開發效率 下面我將介紹使用maven構建的S
maven的Springboot專案的攜程Apollo配置中心的配置以及使用
說明:轉發,複製,必須標明文章的出處,標註原地址以及作者 http://mp.blog.csdn.net/postedit/79044988 作者:暮辰邪 使用配置中心注入application.properties 1、Client等jar包的製作 (1)Apollo
docker學習(六) 使用maven構建springboot docker映象並push到nexus
使用maven構建springboot docker映象並push到nexus 前面學習了使用gradle構建springboot docker映象,docker學習(三) gradle 使用docker外掛自動構建springboot工程,現在學習使用
Docker入門之構建Springboot專案釋出在映象環境
在之前,簡單的講了一下docker環境的搭建,這裡就說一下docker的專案部署,如springboot專案如何執行在docker環境中 這裡其實主要就是在原有下載映象的基礎上進行重新構建。
Springboot後臺restful服務單體架構搭建|第二章 開始構建springboot專案
第二章 開始構建springboot專案 前言 新建專案 SpringBoot 前言 該架構是參考公司原架構做了優化,計劃慢慢從0開始完全獨立自己搭建一個基於springboot的restful服務後臺架構,並且完全
使用idea構建springboot專案報Unregistering JMX-exposed beans on shutdown
關於這個問題網上有好多種解決方法: 第一種:注掉 <scope>provided</scope> <dependency> <groupId>org.springframework.boot</
Eclipse Maven構建WebApp專案資源目錄顯示不全的原因與解決方式
一、問題展示 1、Eclipse在使用Maven構建WebApp專案的時候,首先Maven的安裝和配置都沒有問題的,但是構建專案之後,Maven專案要求的幾個必須要有的資源目錄顯示不了: