Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Could not resolve view with name 'employee/login' in servlet with name 'dispatcherServlet'] with root cause
原因:手快将@RestController注解打成了@Configuration
@Configuration:打在类上,表示当前这个类是Spring配置类,可以用来替代applicationContext.xml,它也是由@Component衍生出来的,因此在Spring扫描到该注解时,会为该注解对应的配置类创建对象并加入IOC容器管理;
@RestController等同于@Controller与@ResponseBody两个注解组合功能,设置当前控制器类为RESTful风格;
@Controller:开启注解扫描之后,Spring会自动创建该类的对象加入IOC容器;
@ResponseBody可以打在类上,类中的所有方法都会直接返回文本数据|json数据,不会再进行视图解析。