我使用 Spring Initializer、嵌入式 Tomcat、Thymeleaf 模板引擎生成了一个 Spring Boot Web 应用程序,并将其打包为可执行 JAR 文件。
使用的技术:
Spring Boot 2.0.0.M6,Java 8,maven
这是我的安全配置
@Override
protected void configure(HttpSecurity http) throws Exception {
final List<String> activeProfiles = Arrays.asList(env.getActiveProfiles());
if (activeProfiles.contains("dev")) {
http.csrf().disable();
http.headers().frameOptions().disable();
}
http
.authorizeRequests()
.antMatchers(publicMatchers()).permitAll()
.anyRequest().authenticated()
.and()
.formLogin().loginPage("/login").defaultSuccessUrl("/iberia/list")
.failureUrl("/login?error").permitAll()
.and()
.logout().permitAll();
}
in my application.properties
server.contextPath=/iberiaWebUtils
server.port=1234
但是当我运行该应用程序时http://localhost:1234/iberiaWebUtils,而不是去http://localhost:1234/iberiaWebUtils/login,应用程序。重定向到http://localhost:1234/登录
我也尝试过
server.context-path=/iberiaWebUtils
结果相同
从...开始春季启动 2.0.0 M1servlet 特定的服务器属性已移至server.servlet
:
Spring Boot 2.0.0 M1 Release Notes
因此,您应该使用server.servlet.context-path
财产。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)