如何更改weblogic的springboot上下文路径?

时间:2019-02-10 00:05:25

标签: java spring maven spring-boot

我用springboot,weblogic和maven创建了项目。还可以使用jsf创建一个简单的hello世界。但是现在我想更改网址。我尝试了更改server.servlet.context-path,但是它不起作用。我在做什么错了?

myURL = http://localhost:7001/SpringBootProject/faces/index.xhtml;

我更改了 application.properties ,如下所示:

spring.application.name= Corp

server.servlet.context-path= /corp

spring.mvc.view.prefix:/WEB-INF/jsf/

spring.mvc.view.suffix:.jsp

Pom.xml

<properties>
    <java.version>1.8</java.version>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>



<dependencies>   

<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>

    </exclusions>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <exclusions>
            <exclusion>
                <artifactId>commons-logging</artifactId>
                <groupId>commons-logging</groupId>
            </exclusion>
        </exclusions>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.2.9</version>
    </dependency>
    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.2.9</version>
    </dependency>

    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>6.1</version>
    </dependency>

     <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
</dependency>

</dependencies>

1 个答案:

答案 0 :(得分:0)

您可以在src/main/webapp/WEB-INF/weblogic.xml中指定context-root。 WebLogic将提取它并覆盖server.servlet.context-path

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
                      http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
  <wls:context-root>/corp</wls:context-root>
</wls:weblogic-web-app>
相关问题