我使用spyder(Python 3.6)编写了以下代码:
@Configuration
@EnableWebSecurity
@Order(SecurityProperties.BASIC_AUTH_ORDER)
public static class SecuritySecureConfig extends WebSecurityConfigurerAdapter {
/* private final String adminContextPath;
public SecuritySecureConfig(AdminServerProperties adminServerProperties) {
this.adminContextPath = adminServerProperties.getContextPath();
}*/
@Override
protected void configure(HttpSecurity http) throws Exception {
// @formatter:off
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter("redirectTo");
successHandler.setDefaultTargetUrl( "/");
http.headers().httpStrictTransportSecurity().disable();
http.authorizeRequests()
.antMatchers( "/assets/**").permitAll()
.antMatchers( "/login").permitAll()
.anyRequest().authenticated()
.and()
.formLogin().loginPage( "/login").successHandler(successHandler).and()
.logout().logoutUrl( "/logout").and()
.httpBasic().and()
.csrf()
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.ignoringAntMatchers(
"/instances",
"/actuator/**"
);
// @formatter:on
}
}
它过去只能在几天前完全正常运行,但是现在出现以下错误:
TypeError:“ str”对象不可调用
我看到案例是有人遇到相同的问题,但是它们的代码更长,人们指出了发出错误消息的某些行,但就我而言,我只是想打印一个句子。发生什么事了?