官术网_书友最值得收藏!

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.
主站蜘蛛池模板: 马龙县| 崇仁县| 壤塘县| 织金县| 阳城县| 高淳县| 南宁市| 崇信县| 台南市| 徐州市| 萝北县| 全椒县| 德化县| 天等县| 石景山区| 德化县| 南澳县| 荣昌县| 高密市| 汉阴县| 乡宁县| 荃湾区| 冕宁县| 寻乌县| 沅陵县| 沿河| 周口市| 西乡县| 咸宁市| 尚义县| 滨海县| 乐安县| 万荣县| 曲麻莱县| 长寿区| 延寿县| 米脂县| 宜宾县| 搜索| 罗定市| 云阳县|