如果不配置默认为空,如下是application.yml文件只配置了端口号
server:port: 6868
那么访问时直接访问服务即可
如果配置了rest服务
@RestController
@RequestMapping("/netLicense")
public class NetLicenseController {@RequestMapping("/getLicense")public AjaxResult getLicense(){List<String> license = LicenseMain.getLicense();return AjaxResult.success(license);}
}
浏览器 访问的时候如下
http://localhost:6868/netLicense/getLicensehttp://localhost:6868/netLicense/getLicense
效果
如果配置了上下文地址,如下
server:port: 6868servlet:context-path: /mywebname
则启动时
浏览器访问时
http://localhost:6868/mywebname/netLicense/getLicensehttp://localhost:6868/mywebname/netLicense/getLicense