我想設置我的項目根據環境使用不同的虛擬主機名稱。jboss-web.xml可以訪問屬性嗎?
我知道我可以在每個目錄中創建一個帶有單獨jboss-web.xml文件的目錄。但我最近把這個項目移到了maven,並想利用這些配置文件。我已經設置了數據庫,因此它們可以通過使用過濾器的配置文件進行不同的配置。
的jboss-web.xml中:
<jboss-web>
<context-root>/</context-root>
<virtual-host>${jbossweb.virtualhost}</virtual-host>
</jboss-web>
環境特定屬性文件中有一個條目:
jbossweb.virtualhost=hostname.domain.com
的POM文件生成部分有這個定義
<filters>
<filter>src/main/filters/filter-${env}.properties</filter>
</filters>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
</resource>
</resources>
剛爲了更好的衡量,配置文件部分具有以下配置:
<profile>
<id>dev</id>
<properties>
<env>dev</env>
</properties>
</profile>
我甚至不確定自己想做什麼是可能的。當我嘗試它時,Jboss-web.xml在虛擬主機位置具有變量名稱,而不是值。
我吠叫錯了樹嗎?
感謝,
埃裏克
它_looks_就像你擁有所有的東西一樣。另一個略有不同的方法是在配置文件定義中包含'jbossweb.virtualhost'的值。 –