我已经生成了两个具有不同属性(DB)的Spring Boot(1.5.10.RELEASE)(war)实例, 我的问题是要在WebSphere Liberty Core 8.5中使用相同的端口但使用不同的上下文来运行这两个实例?
我的server.xml:
<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="9081"
httpsPort="9443"/>
<!-- A application -->
<webApplication id="A" location="A-0.0.1-SNAPSHOT.war" contextRoot="/interactioncorpcontext-a"/>
<!-- B application -->
<webApplication id = "B" location="B-0.0.1-SNAPSHOT.war" contextRoot="/interactioncorpcontext-b"/>
结果:
**http://hostname:9081/interactioncorpcontext-a**
**http://hostname:9081/interactioncorpcontext-b**
答案 0 :(得分:0)
我发现一个解决方案是创建两个战争模块的EAR:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>ear</artifactId>
<packaging>ear</packaging>
<name>${project.artifactId}</name>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>a.b.c</groupId>
<artifactId>AP00959-starter-parent</artifactId>
<version>1.5.10-SNAPSHOT</version>
</parent>
<dependencies>
<!-- Project dependencies -->
<dependency>
<groupId>a.b.c</groupId>
<artifactId>CCS</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>a.b.c</groupId>
<artifactId>mael</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<modules>
<webModule>
<groupId>a.b.c</groupId>
<artifactId>CCS1FRD0</artifactId>
<contextRoot>/interactioncorpcontext-ccs</contextRoot>
</webModule>
<webModule>
<groupId>a.b.c</groupId>
<artifactId>mael</artifactId>
<contextRoot>/interactioncorpcontext-mael</contextRoot>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>
也可以禁用jmx端点:
endpoints:
jmx:
enabled: false