Spring does not give access to the page how to solve?

Good evening, when you configure spring security men, spring does not give access to the page. Namely vivodit I just the html code of a page. Climb the cheder found a line X-XSS-Protection: 1; mode=block, I think because tion when the power goes out in the sprin secur. config headers then everything starts to work.
The question of how to do that without disabling the headers?
Settings
Fundamentally WEB_INF created page test.html
<!DOCTYPE html>
<html lang="en">
the <head>
 <meta charset="UTF-8">
<title>Title</title>
</head>
the <body>
 <h1>TEST SUPER TEST</h1>
</body>
</html>

to it controller
@Controller
public class TestController {

 @RequestMapping(value = "/stest", method = RequestMethod.GET)
 public String main(Model model) {
 return "test";
}
}

Spring sekyuriti config
@EnableWebSecurity
public class SecurityConf extends WebSecurityConfigurerAdapter {
@Override
 protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().
// headers().disable()
.authorizeRequests()
.antMatchers("/stest").permitAll()
}

@Autowired
 public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("Alex").password("alex123").roles("ADMIN");
auth.inMemoryAuthentication().withUser("Masha").password("masha123").roles("USER");
}

}

Sekyuriti initializer
public class SecurityInitializer extends AbstractSecurityWebApplicationInitializer {
}

Web config
@Configuration
@EnableWebMvc
@ComponentScans(value = { @ComponentScan("security.com.springCong"), @ComponentScan("security.com.controller")})
@Import(SecurityConf.class)
public class WebConfig implements WebMvcConfigurer {

@Autowired
 private ApplicationContext applicationContext;

@Bean
 SpringResourceTemplateResolver public templateResolver() {
 SpringResourceTemplateResolver springResourceTemplateResolver = new SpringResourceTemplateResolver();
springResourceTemplateResolver.setApplicationContext(applicationContext);
springResourceTemplateResolver.setPrefix("WEB-INF/");
springResourceTemplateResolver.setSuffix(".html");
 springResourceTemplateResolver.setTemplateMode(/*TemplateMode.HTML*/ "XHTML"); 
 springResourceTemplateResolver.setCacheable(false); 
 return springResourceTemplateResolver;
}

@Bean
 public SpringTemplateEngine templateEngine() {
 SpringTemplateEngine templateEngine = new SpringTemplateEngine();
 templateEngine.addDialect(new LayoutDialect());
templateEngine.setTemplateResolver(templateResolver());
templateEngine.setEnableSpringELCompiler(true);
 return templateEngine;
}

@Override
 public void configureViewResolvers(ViewResolverRegistry registry) {
 ThymeleafViewResolver thymeleafViewResolver = new ThymeleafViewResolver();
thymeleafViewResolver.setTemplateEngine(templateEngine());
thymeleafViewResolver.setContentType("UTF-8");
 thymeleafViewResolver.setViewNames(new String[] {"*"});
registry.viewResolver(thymeleafViewResolver);
}

@Override
 public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**").addResourceLocations("/WEB-INF/resources/");
registry.addResourceHandler("/js/**").addResourceLocations("/WEB-INF/resources/js/");
registry.addResourceHandler("/css/**").addResourceLocations("/WEB-INF/resources/css/");
registry.addResourceHandler("/bs/**").addResourceLocations("/WEB-INF/resources/bs/");
}
}
April 7th 20 at 15:21
1 answer
April 7th 20 at 15:23
Solution
salmeterola this line - thymeleafViewResolver.setContentType("UTF-8"); everything was decided, due to the fact that spring expect only UTF-8 (and didn't just come like this ContentType) he blosil all.

Find more questions by tags JavaSpring