If you were using Microservice with Spring Boot to build different REST API endpoints, context path might help you.

For example, you have two endpoints, each in a Microservice application:

1. team

2. players

They both have sub-route such as:

  • [GET] info
  • [POST] new

For each application you can set up:

team/application.properties:

# all the requests should be prefixed with /team
server.servlet.context-path=/team

players/application.properties:

# all the requests should be prefixed with /team
server.servlet.context-path=/players

Now when you access those endpoints, you should add prefix:

localhost:8080/team/info

[Spring Boot] Set Context path for application in application.properties的更多相关文章

  1. spring boot: 热部署(一) run as – java application (spring-loader-1.2.4.RELEASE.jar)

    spring boot: 热部署(一) run as – java application (spring-loader-1.2.4.RELEASE.jar) 如果使用的run as – java a ...

  2. spring boot 2.x Path with "WEB-INF" or "META-INF"

    学习spring boot 2.x时,使用jsp作为前端页面.在application.properties配置了jsp所在位置 spring.mvc.view.prefix:/WEB-INF/vie ...

  3. 【spring boot】SpringBoot初学(3)– application配置和profile隔离配置

    前言 github: https://github.com/vergilyn/SpringBootDemo 说明:我代码的结构是用profile来区分/激活要加载的配置,从而在一个project中写各 ...

  4. 【spring boot】SpringBoot初学(2.1) - properties读取明细

    前言 算是对<SpringBoot初学(2) - properties配置和读取>的总结吧. 概念性总结 一.Spring Boot允许外化(externalize)你的配置.可以使用pr ...

  5. 曹工说Spring Boot源码(5)-- 怎么从properties文件读取bean

    写在前面的话 相关背景及资源: 曹工说Spring Boot源码(1)-- Bean Definition到底是什么,附spring思维导图分享 曹工说Spring Boot源码(2)-- Bean ...

  6. Spring 梳理-使用<context:property-placeholder>标签导入多个properties文件

    使用<context:property-placeholder>标签导入多个properties文件 2017年12月20日 10:10:36 sf_climber 阅读数:5830更多 ...

  7. (转)spring boot实战(第六篇)加载application资源文件源码分析

    原文:http://blog.csdn.net/liaokailin/article/details/48878447

  8. Spring Boot系列教程四:配置文件详解properties

    一.配置随机数,使用随机数 在application.properties文件添加配置信息 #32位随机数 woniu.secret=${random.value} #随机整数 woniu.numbe ...

  9. spring boot项目下application.properties中使用logging.path和logging.file时的细节

    logging.path仅仅用于指定日志输出的目录,且不能指定输出的文件名,且默认名为spring.log  若指定的是相对目录,则会生成在当前总项目的目录下 idea中新建sprnig boot项目 ...

随机推荐

  1. [转帖]关于USB3.0以及type-C

    忘记来源页面了.. 但是昨天晚上 usb 4.0 发布了 跟雷电C 安全一样的标准 双向40gb 的带宽. 而且 以后只有usb type-C的接口了. 我们办公机器上面的 typeC 同事用 ngf ...

  2. Java:集合类的数据结构

    本文源自参考<Think in Java>,多篇博文以及阅读源码的总结 前言 Java的集合其实就是各种基本的数据结构(栈,队列,hash表等),基于业务需求进而演变出的Java特有的数据 ...

  3. EffectiveC++

    宁可以编译器替换预处理器 define 不被视为语言的一部分,因此也就有可能在预处理阶段被优化掉,导致相关变量出现错误. #define ASPECT_RATIO 1.63 //可以尝试将其替换为 c ...

  4. 【第一季】CH05_FPGA设计Verilog基础(二)Enter a post title

    [第一季]CH05_FPGA设计Verilog基础(二) 5.1状态机设计 状态机是许多数字系统的核心部件,是一类重要的时序逻辑电路.通常包括三个部分:一是下一个状态的逻辑电路,二是存储状态机当前状态 ...

  5. 学习扩展kmp

    参考博客:https://blog.csdn.net/s_999999/article/details/89104957

  6. PHP如何通过URL访问,获得新的URL 两种方法

    1.1 $url = 'http://passport.drcloud.cn/api/logon.asp?id=1&ru=http://203.158.158.122/store/thirdL ...

  7. C# 语言基础学习路线图

    一直以来,对于很多知识点都是存于收藏夹中,随着时间地变更,收藏夹中链接也起来越多,从未进行整理,也很零散,所以想对曾经遇到并使用过的一些知识形成文档,作为个人知识库的一部分. 就从C# 语言基础开始, ...

  8. SQL连接(join)

    INNER JOIN:如果表中有至少一个匹配,则返回行 LEFT JOIN:即使右表中没有匹配,也从左表返回所有的行 RIGHT JOIN:即使左表中没有匹配,也从右表返回所有的行 FULL JOIN ...

  9. SpringCloud 随笔

    目录 服务间通讯 统一配置中心 RabbitMQ Spring Cloud Stream 服务网关 Spring Cloud Zuul ++==(纯手打,代码可能有错!)==++ 服务间通讯 Rest ...

  10. c#向指定的邮箱发送邮件

    private bool SendEmail(string fileName) { MailMessage m_Mail = new MailMessage(); m_Mail.From = new ...