我有一个验证API springboot </跨度> 服务器。当我从POSTMAN调用API时,userDetails对象不为null,我在客户端获得成功。但是,当我从reactJS执行userDetails时,“:”application / json“ }, body:JSON.stringify(data) })。then(response =&gt; {… }) .catch((e)=&gt; {… })
代码 springboot </跨度>
@PostMapping(value =“/ module / authenticate锟)
无需解决方法来处理飞行前请求
在弹簧安全性中正确配置它
@EnableGlobalMethodSecurity(prePostEnabled = true) public class AppSecurityAdapter extends WebSecurityConfigurerAdapter { //... other configuration here @Override public void configure(WebSecurity web) throws Exception { web.ignoring() .antMatchers(HttpMethod.OPTIONS, "/**")