Why does the H2 console in Spring Boot show a blank screen after logging in?

前端 未结 4 1258
故里飘歌
故里飘歌 2020-12-29 02:07

I\'m using Spring Boot 1.4.1 with the H2 database. I have enabled the H2 console as described in the reference guide by adding the following lines to my application.propert

相关标签:
4条回答
  • 2020-12-29 02:12

    I can resolve the same problem using the following code in my SecurityConfig class

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        bla();
        bla();   
        http.headers().frameOptions().sameOrigin();
    }
    

    I don't know what this line does, maybe someone with more experience can explain it.

    0 讨论(0)
  • 2020-12-29 02:23

    Add this to your application.properties

     security.headers.frame=false
    
    0 讨论(0)
  • 2020-12-29 02:23

    Along with the answer by @pacoverflow note the following:

    As of Spring Boot 2.3.4. The DB Name is printed in the console: Connect using that DB name:

    0 讨论(0)
  • 2020-12-29 02:29

    According to a blog post, a line needs to be added to the configure method of the SecurityConfig class if you have the spring-boot-starter-security dependency in your project, otherwise you will see an empty page after logging into the H2 console:

    http.headers().frameOptions().disable();
    

    I added that line and it solved the problem.

    Alternatively, the following line can be used (as mentioned here):

    http.headers().frameOptions().sameOrigin();
    
    0 讨论(0)
提交回复
热议问题