Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 访问控制允许原点';响应中的头不能是通配符'*';_Java_Spring Boot_Spring Security_Thymeleaf - Fatal编程技术网

Java 访问控制允许原点';响应中的头不能是通配符'*';

Java 访问控制允许原点';响应中的头不能是通配符'*';,java,spring-boot,spring-security,thymeleaf,Java,Spring Boot,Spring Security,Thymeleaf,我有Spring启动应用程序。我还使用SpringSecurity和Thymeleaf\ 我有一段代码,可以从数据库中获取tube视频,并将其应用到我的thymeleaf模板中。 如果我在浏览器(任何)中打开开发工具,我会收到错误消息: 访问位于的XMLHttpRequest "来源" “”已被CORS策略阻止:值为 响应中“Access Control Allow Origin”标头的 当请求的凭据模式为“包含”时,必须使用通配符“*”。 XMLHttpRequest启动的请求的凭据模式为 由

我有Spring启动应用程序。我还使用SpringSecurity和Thymeleaf\ 我有一段代码,可以从数据库中获取tube视频,并将其应用到我的thymeleaf模板中。 如果我在浏览器(任何)中打开开发工具,我会收到错误消息:

访问位于的XMLHttpRequest "来源" “”已被CORS策略阻止:值为 响应中“Access Control Allow Origin”标头的 当请求的凭据模式为“包含”时,必须使用通配符“*”。 XMLHttpRequest启动的请求的凭据模式为 由withCredentials属性控制

如果我删除一段代码与你管视频错误将消失

如何解决此错误?

Spring安全配置:

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
                .antMatchers("/admin/**").authenticated()
                .antMatchers("/**").permitAll()
        .and().exceptionHandling().accessDeniedPage("/handlers/access-denied.html")
        .and().csrf().disable();
    }

    @Override
    public void configure(WebSecurity web) {
        web.ignoring().antMatchers(

                // статика
                "/css/**",
                "/js/**",
                "/fonts/**",
                "../libs/**",
                "/images/**"
        );
    }
}
模板: