How do I choose the URL for my Spring Boot webapp?

前端 未结 6 936
粉色の甜心
粉色の甜心 2020-11-30 03:48

I am using Spring Boot to create a web app, and I am not sure how to change the URL from localhost:8080 to something like localhost:8080/myWebApp.

6条回答
  •  甜味超标
    2020-11-30 04:22

    As of spring boot 2 the server.contextPath property is deprecated. Instead you should use server.servlet.contextPath.

    So in your application.properties file add:

    server.servlet.contextPath=/myWebApp

    For more details see: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide#servlet-specific-server-properties

提交回复
热议问题