1.一些springboot中常见的web路径
- 项目启动默认访问 resources文件夹下的index文件
- springboot 默认的项目路径为 localhost:8080
- swagger 的默认访问路径是 127.0.0.1:8090/swagger-ui.html
- tymleaf中的默认的 ‘/‘(根路径)是resources
- tymleaf 中的默认 静态资源(css, js)在 /resources/static文件夹下
- 在yml 文件中的classpath指的是resources 文件夹
- webjars/默认在/resources/static文件夹下
- 所有的 **/favicon.ico (默认的图标) 都是在静态资源文件下找
- 默认的启动端口是8080
- thymleaf中的页面默认在resources 下的template中
2.如何修改
- 修改内置sevlet的容器
server.servlet.context-path=/sw #修改访问路径
spring.application.name=sw #修改项目名称
server.port=8090 #修改访问端口
- 修改swagger-ui.html
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.host("ap"); #这个进行修改访问地址
.select()
.apis(RequestHandlerSelectors.basePackage("com.swagger.api"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("swagger")
.description("http://www.baidu.com/")
.termsOfServiceUrl("http://www.baidu.com/")
.version("1.0")
.build();
}
- 修改thymleaf 的路径
spring.thymeleaf.prefix=跟路径问resources