I encounter a strange problem in my Spring MVC Controller.
I have four pages in my webapp folder
@Controller
public class WelcomeController {
@RequestMapping(value="/wodi/welcome",method=RequestMethod.GET)
public String welcome(){
return "redirect:/pages/webwelcome.html";
}
}
Just now, it worked fine to find the page http://localhost:8080/pages/webwelcome.html
, but now I have the error that the browser says:
There was an unexpected error (type=Method Not Allowed, status=405).
Request method 'GET' not supported
I have no idea what I did that influence it.
I read WARN : org.springframework.web.servlet.PageNotFound - Request method 'GET' not supported
But this is not the same case as mine since I am using "GET" method.
Below is my Application.java to Boot the Spring app
@Configuration
@EnableAutoConfiguration
@ComponentScan({"hello","wodinow.weixin.jaskey"})
public class Application {
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(Application.class, args);
System.out.println("Let's inspect the beans provided by Spring Boot:");
String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
}
@Bean
public CommandService commandService(){
return CommandService.getInstance();
}
}