我正在尝试将请求从一个控制器转发到另一个控制器,但我却遇到了异常
java.lang.IllegalStateException:无法解析名称为“forward:/test2”的视图。在 org.springframework.web.reactive.result.view.ViewResolutionResultHandler.lambda$resolveViews$5(ViewResolutionResultHandler.java:272) ~[spring-web-reactive-5.0.0.BUILD-SNAPSHOT.jar:5.0.0.BUILD-快照]
这是我的控制器:
@Controller
class TestController {
@RequestMapping(value="/test")
public String showTestPage() {
return "forward:/test2";
}
}
@RestController
public class TestController2 {
@RequestMapping(value="/test2")
public String showTestPage() {
return "testPageView";
}
}
我正在使用弹簧引导
springBootVersion = '2.0.0.BUILD-SNAPSHOT' compile('org.springframework.boot.experimental:spring-boot-starter-web-reactive')
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}