Skip to content

Data binding with immutable objects (Kotlin / Lombok / @ConstructorProperties) [SPR-15199] #19763

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

Referenced from: commits fa4d139, 65ba865

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions