en *_*pes 3 spring spring-mvc spring-security spring-boot
我使用Spring Initializer,嵌入式Tomcat,Thymeleaf模板引擎和包作为可执行JAR文件生成了一个Spring Boot Web应用程序.
使用的技术:
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();
    }
在我的 application.properties
server.contextPath=/iberiaWebUtils
server.port=1234
但是当我在http:// localhost:1234/iberiaWebUtils上运行应用程序时,而不是去http:// localhost:1234/iberiaWebUtils/login,应用程序.重定向到http:// localhost:1234/login
我也尝试过
server.context-path=/iberiaWebUtils
结果相同
And*_*lko 11
从Spring Boot 2.0.0开始,M1 servlet特定的服务器属性被移动到server.servlet:
因此,您应该使用该server.servlet.context-path属性.
| 归档时间: | 
 | 
| 查看次数: | 3565 次 | 
| 最近记录: |