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

NoSuchBeanException exception is thrown when validator is disabled #372

Open
mancze opened this issue Jun 4, 2024 · 0 comments
Open

NoSuchBeanException exception is thrown when validator is disabled #372

mancze opened this issue Jun 4, 2024 · 0 comments

Comments

@mancze
Copy link

mancze commented Jun 4, 2024

Expected Behavior

It should be possible to disable Micronaut validation via configuration micronaut.validator.enabled = false.

This is useful, for example, in tests that want to send/read invalid data and make assertions about it.
Note: For simplicity, the linked example application disables the validator in the actual application, not just in the tests.

Actual Behaviour

Exception is thrown:

Unexpected error occurred: Failed to inject value for parameter [validator] of class: io.micronaut.validation.validator.DefaultValidatorFactory

Message: No bean of type [io.micronaut.validation.validator.Validator] exists. The following matching beans are disabled by bean requirements: 
* Bean of type [io.micronaut.validation.validator.DefaultValidator] is disabled because: 
   - Property [micronaut.validator.enabled] with value [false] does not equal required value: true

Steps To Reproduce

  1. Run ValidatorTest in the example application.

Environment Information

No response

Example Application

https://github.com/mancze/micronaut-sandbox/tree/repro/validation-disabled

Version

4.4.3

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

No branches or pull requests

1 participant