带有webflux和路由器功能的Spring boot 2不能与独立的tomcat服务器一起使用

时间:2018-03-13 18:39:08

标签: spring-boot tomcat8 spring-webflux

应用程序在spring boot嵌入式tomcat 8.5.28(gradle bootRun)上正常运行但是当我创建war并将其放在独立的tomcat服务器(8.5.28)中时,应用程序总是为任何配置的路由抛出404

load.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {

        ArrayList<ArrayList<String>> obj = XmlToObject.main();

        for(ArrayList<String> r: obj){
            for(int i = 0; i < r.size(); i++){
                System.out.println(r.get(i) + "");
            }
            textArea.setText(r.get(0));
            textArea1.setText(r.get(1));
            textArea2.setText(r.get(2));
            textArea3.setText(r.get(3));
            textArea4.setText(r.get(4));
            mediaPlayerComponent.getMediaPlayer().setPosition(Float.parseFloat(r.get(5)));
            mediaPlayerComponent2.getMediaPlayer().setPosition(Float.parseFloat(r.get(6)));
        }
    }
});

这些是路由配置。

@SpringBootApplication
public class BookServiceApplication extends AbstractReactiveWebInitializer {
    public static void main(String[] args) {
        SpringApplication.run(BookServiceApplication.class, args);
    }

@Override
    protected Class<?>[] getConfigClasses() {
        return new Class[]{
            RoutingConfiguration.class,
            BookServiceHandler.class,
            BookService.class
        };
}

应用程序在spring boot嵌入式tomcat 8.5.28(gradle bootRun)上正常运行但是当我创建war并将其放在独立的tomcat服务器(8.5.28)中时,应用程序总是为任何配置的路由抛出404

1 个答案:

答案 0 :(得分:3)

Spring Boot 2.0目前不支持WebFlux应用程序的WAR部署。

请参阅您创建的Spring Boot问题:https://github.com/spring-projects/spring-boot/issues/12455