paulcwarren / spring-content

Cloud-Native Storage and Enterprise Content Services (ECMS) for Spring
https://paulcwarren.github.io/spring-content/
Apache License 2.0
268 stars 65 forks source link

Supports POJO classes with public fields without accessors (getter/setter) #1372

Open Nick-Wunderdog opened 1 year ago

Nick-Wunderdog commented 1 year ago

Is your feature request related to a problem? Please describe. Spring supports POJO classes without accessors (getter/setter) with just public fields, aka. anamic classes. While anemic classes are contraversial issue, Spring and all relates other libraries do support them so for this to be compatible and follow Spring convention, so should this library support them.

Describe the solution you'd like Support Entity class annotated public fields without accessor methods. Like Spring Data (REST) does.

Describe alternatives you've considered Document clearly that anemic classes are not supported with this library.

Additional context Anemic classes are contraversial but there is school of though that they are ok in Entity classes as those should NOT contain any business logic. So them being anamic and immutable would be ideal. Unfortunately it is difficult or even impossible to make them immutable (to make fields public final) so all of the solutions are helf measures. And since there is no clear universal convention on this, it would be nice to support commonly accepted best practices. Even if their schools of though are at war each others. Some - like myself - think that anemic entity classes are smaller antipatterns than contaminating whole project with Lombok.

paulcwarren commented 1 year ago

This is a bit of a controversial topic and this is the first time anyone has raised it, I think. So, most users probably aren't following this pattern. That said I can look into what it would take to support. If it is not that much then I'd be fine adding it to bring closer to official Spring projects.

Be great to see some upvotes too though.

Nick-Wunderdog commented 1 year ago

Like I said the fuctionality itself is bit of contraversial. Main reason this should be supported is to be in-line with Spring, as they suport this. But this is not high priority feature request.