Skip to content

vaadin-spring-boot-starter 15.0.5 projects do not start with Spring Boot 2.3 #606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Artur- opened this issue Apr 23, 2020 · 8 comments · Fixed by #608
Closed

vaadin-spring-boot-starter 15.0.5 projects do not start with Spring Boot 2.3 #606

Artur- opened this issue Apr 23, 2020 · 8 comments · Fixed by #608
Labels
fusion Changes required for fusion

Comments

@Artur-
Copy link
Member

Artur- commented Apr 23, 2020

Spring Boot 2.3 has removed the validation implementation spring-boot-starter-validation from spring-boot-starter-web, see spring-projects/spring-boot#19550. If you take the Spring starter today and upgrade to 2.3.0.M3, startup fails with

***************************
APPLICATION FAILED TO START
***************************

Description:

The Bean Validation API is on the classpath but no implementation could be found

Action:

Add an implementation, such as Hibernate Validator, to the classpath
@Artur-
Copy link
Member Author

Artur- commented Apr 23, 2020

Adding

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>

works around the problem

@snicoll
Copy link
Contributor

snicoll commented Apr 23, 2020

Is the validation piece mandatory in Vaadin?

@Legioth
Copy link
Member

Legioth commented Apr 23, 2020

The validation API is only used for one optional feature, namely BeanValidationBinder which is a custom version of the generic Binder. We should have our own logic there that tries to find an implementation only if you're using that particular class and even in that case it should fail with our own custom error message if no implementation is available.

@Legioth
Copy link
Member

Legioth commented Apr 23, 2020

@vlukashov Did we also add something related to validation for endpoints in Vaadin 15, or is everything there still pending the full form binding functionality that is being implemented right now?

@denis-anisimov
Copy link

I don't understand which functionality prints the error.
Bean validation impl is needed only when you are using BeanValidationBinder explicitly.
And it prints the error if you don't have the impl.

Otherwise the bean validation impl is not needed and never checked.

So it looks like it's not code in Flow or Spring add-on which prints the error message and fails the app to start.

It looks like this is Spring itself which prints the message.
So it's the matter of the generated project configuration : it needs to be changed somehow so Spring doesn't complain.

And to be able to understand the reason exactly I would like to see exact steps to reproduce which I'm lacking from the description.

@Artur-
Copy link
Member Author

Artur- commented Apr 24, 2020

@Artur-
Copy link
Member Author

Artur- commented Apr 24, 2020

Running

mvn -X

shows the reason as

2020-04-24 11:47:12.642  WARN 43740 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.vaadin.flow.server.connect.VaadinConnectController': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.vaadin.flow.server.connect.VaadinConnectController]: Constructor threw exception; nested exception is javax.validation.NoProviderFoundException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.

@denis-anisimov
Copy link

Alright, thanks.

 private final Validator validator = Validation
            .buildDefaultValidatorFactory().getValidator();

in the class VaadinConnectController.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fusion Changes required for fusion
Projects
None yet
4 participants