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 · May be fixed by #447
Open

NoSuchBeanException exception is thrown when validator is disabled #372

mancze opened this issue Jun 4, 2024 · 0 comments · May be fixed by #447

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

altro3 added a commit to altro3/micronaut-validation that referenced this issue Nov 12, 2024
@altro3 altro3 linked a pull request Nov 12, 2024 that will close this issue
altro3 added a commit to altro3/micronaut-validation that referenced this issue Nov 12, 2024
altro3 added a commit to altro3/micronaut-validation that referenced this issue Nov 12, 2024
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

Successfully merging a pull request may close this issue.

1 participant