我正在按照本教程第 5 部分:将 Spring Security 与 Spring Boot Web 集成,尝试将 Spring Security 功能添加到我的网页,但遇到大量配置问题。
所以我已经到了需要@Override这个方法的部分:
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login");
}
Run Code Online (Sandbox Code Playgroud)
但我不太确定将代码放在哪里。我用谷歌搜索发现大多数人将它放在扩展的类中,WebSecurityConfigurerAdapter但这在我的情况下不起作用,我收到一条错误消息,指出该方法不会覆盖其超类中的任何方法。
这是我的SecurityConfig扩展WebSecurityConfigurerAdapter:
@Configuration
@EnableWebMvcSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests().anyRequest().authenticated()
.antMatchers("/resources/**").permitAll()
.anyRequest().permitAll();
http
.formLogin().failureUrl("/ingresar?error")
.defaultSuccessUrl("/")
.loginPage("/ingresar").permitAll()
.and()
.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.logoutSuccessUrl("/logout")
.permitAll();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("user").password("password").roles("USER");
}
}
Run Code Online (Sandbox Code Playgroud)
任何想法 ??我已经尝试了好几个小时了!
我需要在自定义字段中计算日期是否超过 2 年前...如果是,则返回 YES,否则返回 NO
我正在尝试这个公式,将返回类型设为“文本” Last_won_deal_date__c > DATEVALUE("2 years ago"),但出现以下错误:
错误:公式结果的数据类型(布尔值)与预期的数据类型(文本)不兼容。