繁体   English   中英

Spring Boot中的文件夹映射以从URL Spring打开图像

[英]folder mapping in spring boot to open images from url spring

我想将本地文件夹映射到localhost:8080如何实现此目的。 我正在使用弹簧靴。 已经将allowall授予了public / pic文件夹。

如下所示如何在浏览器中打开。

HTTP://本地主机:8080 /大众/ PIC / default.jpg

上面的链接给出401,并询问用户名和密码。

在春季使用以下代码来提高安全性

@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文件夹应该在哪里?

尝试添加到您的配置

@Override
public void configure(WebSecurity webSecurity) {
    webSecurity.ignoring().antMatchers("/public/pic/**");
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM