1. Some common web paths in springboot
- The index file in the resources folder is accessed by default when the project starts
- The default project path of springboot is localhost:8080
- The default access path of swagger is 127.0.0.1:8090/swagger-ui.html
- The default'/' (root path) in tymleaf is resources
- The default static resources (css, js) in tymleaf are in the /resources/static folder
- The classpath in the yml file refers to the resources folder
- webjars/ is under the /resources/static folder by default
- All **/favicon.ico (default icon) are found under the static resource file
- The default startup port is 8080
- The pages in thymleaf are by default in the template under resources
2. How to modify
- Modify the built-in sevlet container
server.servlet.context-path=/sw #修改访问路径
spring.application.name=sw #修改项目名称
server.port=8090 #修改访问端口
- Refurbished 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();
}
- Modify the path of thymleaf
spring.thymeleaf.prefix=跟路径问resources