Close
« Tutorial

Spring MVC - Immutable Bean Data Binding MCQ

0/13
0 ✓
0 ✗

1. What is an immutable bean class?

2. From which Spring version can data binding work with immutable classes?

3. Before Spring 5, what did a bean class need so that request parameters could be bound to it?

4. What happened in versions before Spring 5 when request parameters were bound to a class that had no no-argument constructor?

5. How does Spring 5 detect a data class that it can bind using a constructor?

6. How does Spring decide which request parameter goes to which constructor argument?

7. What does Spring need in order to know the names of the constructor parameters?

8. Which Java 8+ compiler flag keeps constructor parameter names, so Spring can match them with request parameter names?

9. What is the purpose of the @ConstructorProperties annotation?

10. Where do we place the @ConstructorProperties annotation?

11. When can @ConstructorProperties be left out?

12. A constructor is declared as shown below. Which request parameter names will Spring use for binding?

@ConstructorProperties({"code", "city"})
public Address(String a, String b) { ... }

13. How are request parameter values given to an immutable bean?

Join