我看到了有关它的其他主题:HERE,但是我使用Spring Boot运行内存数据库H2,而且我不知道如何更改我的H2端口。这是唯一的方法吗?我不能在同一个端口上安装Tomcat AND数据库吗?
答案 0 :(得分:0)
没有两个进程可以在同一个端口上运行。所以,其中一个你需要更新。最好尝试更改tomcat端口号。
此外,尝试使用tomcat凭据登录,您的tomcat应用程序可能受到保护。请参阅tomcat-users.xml。
答案 1 :(得分:0)
我在POM.xml中添加了SpringSecurity,当它添加Spring Boot自动预先配置一些东西时 - 增加了一些安全性。
添加了配置类,它工作正常。
@Configuration
公共类SecurityConfiguration扩展了WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
.authorizeRequests()
.antMatchers("/")
.permitAll();
// disabling csrf tokens and x-frame-options to be able to run h2 console (localhost:8080/console)
httpSecurity.csrf().disable();
httpSecurity.headers().frameOptions().disable();
}
}