Closed
Description
Benjamin M opened SPR-15199 and commented
I'm trying to integrate Lombok with my Spring Project. Now I came across the first issue:
@lombok.Value
public class MyGetParamContainer {
String foo;
int bar;
}
@RequestMapping(...)
public void foo(MyGetParamContainer params) {
// ...
}
This will result in an Exception:
org.springframework.beans.BeanInstantiationException: Failed to instantiate [MyGetParamContainer]: No default constructor found
This happens because it's an immutable object, which sets all its values though its constructor.
Though it would be really nice if Spring could take care of @ConstructorProperties
if there's no default constructor.
Affects: 4.3.6, 5.0 M4
Issue Links:
- Provide support for configuring the bindable properties of a form-backing object using field-level annotations [SPR-7747] #12403 Provide support for configuring the bindable properties of a form-backing object using field-level annotations
- Kotlin class instantiation with optional parameters and default values [SPR-15673] #20232 Kotlin class instantiation with optional parameters and default values
- Document functional configuration style [SPR-15049] #19615 Document functional configuration style
- Doc: First class support for java 8 parameter names API [SPR-13903] #18477 Doc: First class support for java 8 parameter names API
- BindingResult support for constructor argument mismatch on immutable data object [SPR-15542] #20101 BindingResult support for constructor argument mismatch on immutable data object
- Revisit handling of missing fields (without default values) for immutable data classes [SPR-15877] #20432 Revisit handling of missing fields (without default values) for immutable data classes
- Immutable object constructor arguments not considering WebDataBinder's FIELD_MARKER_PREFIX [SPR-15871] #20426 Immutable object constructor arguments not considering WebDataBinder's FIELD_MARKER_PREFIX