spring引导中的java文件夹映射到从url spring打开图像
我想将本地文件夹映射到localhost:8080我如何实现这一点。 我用的是弹簧靴。已向公用/pic文件夹授予权限
如何在浏览器中打开,如下所示
http://localhost:8080/public/pic/default.jpg
上面的链接给出401并要求输入用户名和密码
在spring中使用以下代码进行安全保护
@Override
protected void configure (HttpSecurity http) throws Exception {
http.csrf().disable();
http.cors().disable();
http.authorizeRequests()
.antMatchers("/public/pic/**").permitAll()
.anyRequest().authenticated()
.and()
.httpBasic()
.and()
.logout();
// @formatter:on
}
本地系统中的文件夹/public/pic应该在哪里
# 1 楼答案
尝试添加到你的配置中