我在STS中有一个Spring Boot应用程序。当我从IDE运行它时,一切正常。但是,当我使用 mvn clean install 创建jar时,我得到:当我尝试启动应用程序时,解析模板/登录时出错。这是我的配置:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/admin/**").hasRole("ADMIN")
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.logoutSuccessUrl("/login?logout")
.permitAll();
}
和
*@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
super.addViewControllers(registry);
registry.addViewController("/login").setViewName("/login");
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
}*