- Spring 5.0 Projects
- Nilang Patel
- 96字
- 2021-07-02 12:34:59
Managing static resources
If you look back at the com.nilangpatel.worldgdp.AppConfiguration class, you will see that we have overridden the addResourceHandlers method of WebMvcConfigurer interface. In the method implementation shown in the following code, we have mapped the static resources prefix URL /static/** to the static resources location /static/ in the webapp directory:
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**")
.addResourceLocations("/static/");
}
We have added a few static resources (both CSS and JavaScript) in the /src/main/webapp/static folder of the project. Please download the code of this chapter and refer to them side by side.
推薦閱讀
- 社交網絡對齊
- 從區塊鏈到Web3:構建未來互聯網生態
- 工業控制網絡安全技術與實踐
- Hands-On Full Stack Development with Spring Boot 2 and React(Second Edition)
- 城市治理一網統管
- Building RESTful Web services with Go
- 網絡安全應急響應技術實戰
- 光纖通信系統與網絡(修訂版)
- 物聯網與智能家居
- Learning Storm
- 網絡工程實施技術與方案大全
- INSTANT LinkedIn Customization How-to
- LwIP應用開發實戰指南:基于STM32
- Guide to NoSQL with Azure Cosmos DB
- 人際網絡