Skip to content
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

LocalValidatorFactoryBean doesn't implement ValidatorFactory.getClockProvider() [SPR-17462] #21994

Closed
spring-projects-issues opened this issue Nov 2, 2018 · 3 comments
Assignees
Labels
in: core status: declined

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Nov 2, 2018

pjverity opened SPR-17462 and commented

Using spring-boot 2.1.0.RELEASE, I use the starter:

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

This places javax.validation:validation-api:2.0.1.Final on the classpath. That version of the validation API has an interface method ValidatorFactory.``ClockProvider getClockProvider() which isn't implemented by LocalValidatorFactoryBean.

The code is here:

implements ValidatorFactory, ApplicationContextAware, InitializingBean, DisposableBean {


Affects: 5.1.2

Reference URL:

implements ValidatorFactory, ApplicationContextAware, InitializingBean, DisposableBean {

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Nov 2, 2018

pjverity commented

Ah. Just read the JavaDoc - perhaps this is intentional.

If you'd like to call BV 2.0's getClockProvider() method, obtain the native ValidatorFactory through unwrap(ValidatorFactory.class)

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Nov 4, 2018

Juergen Hoeller commented

Indeed, this is intentional since we need to retain Bean Validation 1.1 compatibility at runtime for the time being. LocalValidatorFactoryBean is only really a bootstrap delegate and not internally injected into constraint implementations (which is where getClockProvider() is meant to be used), so there shouldn't be any practical implications.

@spring-projects-issues spring-projects-issues added type: bug status: declined in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: bug label Jan 12, 2019
@VikkeyJiang
Copy link

@VikkeyJiang VikkeyJiang commented Nov 19, 2020

usually we cannt compile a class without implemets all interface method , i'm curious about how spring makes it work~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core status: declined
Projects
None yet
Development

No branches or pull requests

3 participants