第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何從 Spring Boot 項(xiàng)目中獲取當(dāng)前的 thymeleaf 版本?

如何從 Spring Boot 項(xiàng)目中獲取當(dāng)前的 thymeleaf 版本?

阿波羅的戰(zhàn)車 2021-12-30 20:35:09
我有一個(gè) Spring Boot 2.1.0.RELEASE 項(xiàng)目。我怎樣才能看到它使用的百里香葉版本?
查看完整描述

3 回答

?
繁星淼淼

TA貢獻(xiàn)1775條經(jīng)驗(yàn) 獲得超11個(gè)贊

如果您使用的是 Maven,則可以使用Maven 依賴插件的list目標(biāo):


$ mvn dependency:list -DincludeArtifactIds=thymeleaf

或者使用 Maven 包裝器:


$ ./mvnw dependency:list -DincludeArtifactIds=thymeleaf

Maven 的示例輸出:


[INFO] --- maven-dependency-plugin:2.8:list (default-cli) @ site ---

[INFO] 

[INFO] The following files have been resolved:

[INFO]    org.thymeleaf:thymeleaf:jar:3.0.9.RELEASE:compile

對(duì)于搖籃:


$ gradle dependencyInsight --dependency org.thymeleaf:thymeleaf

帶包裝:


$ ./gradlew dependencyInsight --dependency org.thymeleaf:thymeleaf

Gradle 的示例輸出:


org.thymeleaf:thymeleaf:2.1.6.RELEASE (selected by rule)

\--- org.thymeleaf:thymeleaf-spring4:2.1.6.RELEASE

     \--- org.springframework.boot:spring-boot-starter-thymeleaf:1.5.9.RELEASE

          \--- compile


org.thymeleaf:thymeleaf:2.1.4.RELEASE -> 2.1.6.RELEASE

\--- nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:1.4.0

     \--- org.springframework.boot:spring-boot-starter-thymeleaf:1.5.9.RELEASE

          \--- compile


org.thymeleaf:thymeleaf-spring4:2.1.6.RELEASE (selected by rule)

\--- org.springframework.boot:spring-boot-starter-thymeleaf:1.5.9.RELEASE

     \--- compile


查看完整回答
反對(duì) 回復(fù) 2021-12-30
?
森林海

TA貢獻(xiàn)2011條經(jīng)驗(yàn) 獲得超2個(gè)贊

如果您使用的是 IntelIJ,一個(gè)不錯(cuò)且簡(jiǎn)單的解決方案是單擊 Maven Projects(在右側(cè))并展開依賴項(xiàng)。 

http://img1.sycdn.imooc.com//61cda79e000163fd10820677.jpg


查看完整回答
反對(duì) 回復(fù) 2021-12-30
?
楊魅力

TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超6個(gè)贊

根據(jù) Spring Docs,您可以使用應(yīng)用程序?qū)傩晕募p松完成此操作。


您可以使用資源過濾從 Maven 項(xiàng)目中自動(dòng)擴(kuò)展屬性。如果您使用 spring-boot-starter-parent,則可以通過 @..@ 占位符引用您的 Maven“項(xiàng)目屬性”


Maven pom.xml:


<groupId>com.poo</groupId>

    <artifactId>gar</artifactId>

    <version>0.0.1-SNAPSHOT</version>

    <packaging>jar</packaging>


<name>Poo</name>

<description>Gar</description>


<parent>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-starter-parent</artifactId>

    <version>1.5.4.RELEASE</version>

    <relativePath /> <!-- lookup parent from repository -->

</parent>

Spring application.properties:


poo.app.version=@project.version@

然后可以使用@ControllerAdvice 注釋的類將版本作為模型屬性注入。


 @ControllerAdvice 

 public class ControllerAdvice {


@Value("${poo.app.version}")

private String applicationVersion;


@ModelAttribute("applicationVersion")

public String getApplicationVersion() {

    return applicationVersion;

}}

最后,這個(gè)模型屬性可以像任何其他屬性一樣被 Thymeleaf 訪問。使用 th:text 標(biāo)簽,嘗試訪問下面的模型屬性,以便您可以顯示您的應(yīng)用程序正在使用的 Thymeleaf 版本:


${applicationVersion}


查看完整回答
反對(duì) 回復(fù) 2021-12-30
  • 3 回答
  • 0 關(guān)注
  • 784 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)