When using JSR-303 Bean Validation, where can the validation annotations be placed?
- Only on fields within a class.
- Only on method parameters.
- Both on fields within a class and on method parameters.
- Only on class-level annotations.
Validation annotations in JSR-303 can be placed both on fields within a class and on method parameters. This flexibility allows you to validate not only the data fields of a class but also method parameters to ensure that the input meets the specified constraints. The other options are not accurate; you can use validation annotations in both scenarios mentioned.
Loading...
Related Quiz
- Which Spring Boot feature is commonly used to automate the database schema creation and update process?
- You are working on a Spring Boot application where you need to implement dynamic DataSource routing based on specific conditions. How would you design and implement this functionality?
- In a Spring Boot application, how can you specify that a method parameter should be bound to a web request parameter?
- How can a custom auto-configuration be created in Spring Boot?
- In which scenario would you use the @ConditionalOnProperty annotation in Auto Configuration?