I can't retrieve the neither blog.html nor other htmls with trying localhost:8080/blog . When i am trying to access /blog path i get Whitelabel Error Page so its 404 not found and in the console log i am seeing " ResourceHttpRequestHandler : Path represents URL or has "url:" prefix: [classpath:/templates/blog.html]
" warning. When i change my @controller to @restcontroller i can access /blog path but with @controller i can't access it . Thank you in advance
my project structure :
Testt.java so my controller class :
@Controller public class Testt {
@GetMapping(path = "/blog") public String getAbout() { return "blog"; }
}
SecurityConfig.java so my spring security config class :
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests().antMatchers(HttpMethod.GET).permitAll();
}
}
EstoreAppApplication.java so my boostrapper springbootjava class:
@SpringBootApplication
public class EstoreAppApplication {
public static void main(String[] args) {
SpringApplication.run(EstoreAppApplication.class, args);
}
}
my application properties :
spring.mvc.view.prefix=classpath:/templates/
spring.mvc.view.suffix=.html
Just a guess, as you didn't mention your pom.xml file,but:
.
Remove the
spring.mvc.view.
properties.Try again.