赞
踩
原因:spring security在引入actuator后安全校验配置.不配置其他接口就会报401
- @EnableWebSecurity
- @Configuration(proxyBeanMethods = false)
- public class ActuatorSecurityConfiguration extends WebSecurityConfigurerAdapter {
-
- /**
- * http验证配置.
- *
- * @param http
- * @throws Exception
- */
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- http.requestMatcher(EndpointRequest.toAnyEndpoint())
- // 放开所有验证
- .authorizeRequests((requests) -> requests.anyRequest().permitAll());
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。