H2-Console is not showing in browser
If you have override configure method of Spring Security and you want to use console of h2 database in browser, and after connect h2-console showing loading error as shown in below image.
Then you have to add following line in your overridden configure method.
After adding that BOLD line, your issue would be resolved. :)
Then you have to add following line in your overridden configure method.
@EnableWebSecuritypublic class SecurityConfig extends WebSecurityConfigurerAdapter { Logger logger = LoggerFactory.getLogger(SecurityConfig.class); //...... @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/").permitAll(); http.authorizeRequests().antMatchers("/imgs/**").permitAll(); http.authorizeRequests().antMatchers("/admin/**").hasRole("ADMIN"); http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin(); // add this line to use H2 web console
http.headers().frameOptions().disable();
}}After adding that BOLD line, your issue would be resolved. :)

Comments
Post a Comment