Java Spring Boot Admin未加载管理页面&;为登录页面加载UI
我需要Spring Boot 1.5版的Spring Boot管理员帮助 问题:我放弃了github中提供的创建Spring Boot Admin应用程序的步骤 我将@EnableAdminServer注释应用于我的Startup类 我可以看到登录页面正在加载,但是样式没有加载,一旦我在输入用户名和密码后点击登录按钮,它就不会重定向到Spring Boot Admin主页 使用的依赖项如下:Java Spring Boot Admin未加载管理页面&;为登录页面加载UI,java,spring,spring-boot,spring-boot-actuator,spring-boot-admin,Java,Spring,Spring Boot,Spring Boot Actuator,Spring Boot Admin,我需要Spring Boot 1.5版的Spring Boot管理员帮助 问题:我放弃了github中提供的创建Spring Boot Admin应用程序的步骤 我将@EnableAdminServer注释应用于我的Startup类 我可以看到登录页面正在加载,但是样式没有加载,一旦我在输入用户名和密码后点击登录按钮,它就不会重定向到Spring Boot Admin主页 使用的依赖项如下: <dependencies> <dependency>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui-login</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
</dependencies>
截图:
删除spring boot管理服务器ui登录。然后它将加载正确的login.htm和相关的css文件 删除此文件并重新生成并运行
共中心
spring启动管理服务器ui登录
1.5.1
删除spring boot管理服务器ui登录。然后它将加载正确的login.htm和相关的css文件
删除此文件并重新生成并运行
共中心
spring启动管理服务器ui登录
1.5.1
让您的安全配置
像下面这样应该可以工作
@Configuration
public static class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.authorizeRequests()
.antMatchers("/login.html", "/**/*.css", "/img/**", "/third-party/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin().loginPage("/login.html").loginProcessingUrl("/login").permitAll()
.and()
.logout().logoutUrl("/logout")
.and()
.httpBasic();
}
}
让您的
SecurityConfig
像下面这样应该可以工作
@Configuration
public static class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable()
.authorizeRequests()
.antMatchers("/login.html", "/**/*.css", "/img/**", "/third-party/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin().loginPage("/login.html").loginProcessingUrl("/login").permitAll()
.and()
.logout().logoutUrl("/logout")
.and()
.httpBasic();
}
}
样式未加载,管理员登录页未加载(获取404)您在
http
上的操作顺序。看起来您正在授权访问css、img等,然后再次删除它,并与/**
匹配。尝试反转这两条语句。样式没有加载,管理员登录页也没有加载(获取404)您在http
上的操作顺序。看起来您正在授权访问css、img等,然后再次删除它,并与/**
匹配。试着把这两种说法颠倒过来。