Java dispatcherServletRegistration春季启动异常

Java dispatcherServletRegistration春季启动异常,java,spring,spring-boot,vaadin,Java,Spring,Spring Boot,Vaadin,请帮助,我尝试将Vaadin放在我的(Spring boot)服务器上,在设置了一个简单的示例后,我得到以下错误: 无法注册在类路径资源[com/vaadin/flow/spring/springbootsautoconfiguration.class]中定义的bean“dispatcherServletRegistration”。已在类路径资源[org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoCon

请帮助,我尝试将Vaadin放在我的(Spring boot)服务器上,在设置了一个简单的示例后,我得到以下错误:

无法注册在类路径资源[com/vaadin/flow/spring/springbootsautoconfiguration.class]中定义的bean“dispatcherServletRegistration”。已在类路径资源[org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration.class]中定义了具有该名称的bean,并且已禁用覆盖

然后,为了纠正错误,我在application.prop中写入: spring.main.allow bean定义重写=true

并获取以下错误:

org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration中构造函数的参数1需要找不到类型为“org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath”的bean

POM.XML:

<?xml version="1.0" encoding="UTF-8"?>
和瓦丁样品:

@Route("/TestMySelf")
public class MainView extends VerticalLayout {
  public MainView() {
    Label label = new Label("Hello its CloudLiquid");
  }
}

您正在使用的vaadin spring boot starter的版本是什么

从,它说这是已知的问题,当某些旧版本的
vaadin spring boot starter
与spring boot 2.1一起使用时,它将在一些较新的版本中修复:

我们还有另一个解决办法,也即将找到解决办法 无需解决方案即可正确修复。不管哪个 我们首先使用的方法是,下周我们将发布 使用弹簧靴2.1。(v10、v11和v12)

抱歉,在更新到Spring之前让您一直处于等待状态 启动2.1,我们应该早点看这个-我的错


从发行说明来看,版本10.1.0支持SpringBoot2.1。因此,我的建议是将vaadin spring boot starter升级至至少10.1.0或最新版本。

对于初学者,停止混用spring boot版本(2.1.1、2.1.0、2.0.1),这是不可避免的问题。不要混合使用来自不同版本框架的JAR。简而言之,从alle
org.springframework.boot
依赖项中删除
,这些依赖项都是由初学者管理的。
@SpringBootApplication()
@EntityScan("com/lopamoko/cloudliquid/dataModel")
@EnableJpaRepositories(basePackages =    "com.lopamoko.cloudliquid.repository")
public class CloudliquidApplication extends SpringBootServletInitializer {

public static void main(String[] args) {
    ApplicationContext ctx = SpringApplication.run(CloudliquidApplication.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);
    }
    FirebaseConfig firebaseConfig = new FirebaseConfig();
    firebaseConfig.configurateFirebaseApplication();

}


@Bean
public DadataService dadataService() {
    return new DadataServiceImpl();
}

@Bean
public DadataClient dadataClient() {
    return Feign.builder()
            .client(new OkHttpClient())
            .encoder(new GsonEncoder())
            .decoder(new GsonDecoder())
            .logger(new Slf4jLogger(DadataClient.class))
            .logLevel(Logger.Level.FULL)
            .target(DadataClient.class, "https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/address");
}

@Bean
public CustomerDeliveryService customerDeliveryService() {
    return new CustomerDeliveryServiceImpl();
}

@Bean
public OrderService orderService() {
    return new OrderServiceImpl();
}

@Bean
public YandexService yandexService() {
    return new YandexServiceImpl();
}

@Bean
public CategoryService categoryService() {
    return new CategoryServiceImpl();
}

@Bean
public ShopService shopService() {
    return new ShopServiceImpl();
}


@Bean
public CommentService commentService() {
    return new CommentServiceImpl();
}

@Bean
public RatingService ratingService() {
    return new RatingServiceImpl();
}

@Bean
public ProductService productService() {
    return new ProductServiceImpl();
}


@Bean
public TomcatServletWebServerFactory tomcatFactory() {
    return new TomcatServletWebServerFactory() {
        @Override
        protected void postProcessContext(Context context) {
            ((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
        }
    };
})
@Route("/TestMySelf")
public class MainView extends VerticalLayout {
  public MainView() {
    Label label = new Label("Hello its CloudLiquid");
  }
}