【问题标题】:RemoteSpringApplication leads to 403RemoteSpringApplication 导致 403
【发布时间】:2018-11-26 19:27:52
【问题描述】:

我可以在编辑时使用RemoteSpringApplication 重新加载应用程序,直到我为我的应用程序添加弹簧安全性,

@EnableWebSecurity
public class WebAuthConfig extends WebSecurityConfigurerAdapter { ..

虽然我添加了事件:

// TODO: this disable all security checks     httpSecurity.httpBasic().disable().authorizeRequests().anyRequest().permitAll(); 

所以我所有的休息电话在没有任何身份验证的情况下仍然有效,

只要我更改代码并运行 RemoteSpringApplication 检测到更改失败:

Exception in thread "File Watcher" java.lang.IllegalStateException: Unexpected 403 response uploading class files

如何预防?

谢谢

【问题讨论】:

    标签: java spring-boot spring-security hot-reload


    【解决方案1】:

    添加:

          .authorizeRequests()
          .antMatchers("/.~~spring-boot!~/**")
          .permitAll()
          .and()
    

    configure(HttpSecurity http) 方法中 http 方法链顶部附近的 Spring Security 配置,它将禁用 Spring Boot DevTools URL 上的 Spring Security。

    如果您想更改此 URL,可以通过更改 application.properties 中的 spring.devtools.remote.context-path 属性来覆盖它。

    请确保您没有在生产环境中运行 devtools!

    【讨论】:

      猜你喜欢
      • 2012-04-21
      • 1970-01-01
      • 2015-03-31
      • 2015-07-17
      • 2015-07-01
      • 2012-06-12
      • 2015-08-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多