Posts

Showing posts with the label binding

Java SPI

Image
Java SPI is a standard java way to have binding between contracts and implementations. SPI used for several use cases such as Currency, Locale, TimeZone, DateFormat, Number, JDBC Driver, JPA, Json, JasonB, and many more. I believe the most classical example is for JDBC/JPA use cases where you have one common spec(contract) and multiple implementations for each database driver such as MySQL, Postgres, etc... SPI is interesting, shower I would not use SPI for common bread a butter SOA / Microservices use cases. Because often you just have one contract and one implementation, for that case using the new keyword or even basic DI/IoC I would say is much more desirable, easier, and much more simple and straightforward. However, if your use case has multiple implementations(beyond versioning) thats definitely something you should consider.

Object Binding with remap in Java

Image
Object binding or mapping is something as old as Java. Sometimes you need to use this technique in order to isolate your core domain from your contract or with your persistence layer. It's always a good idea to have a clean and separated core.  DDD calls it an Anti-Corruption Layer . SOC(Separation of concerns) is always a good idea. As time passes Services and Services teams kind of lose that great Architectural and SOA Principles no wonder things are harder them before.  So today I want to talk a bit and show some code about a library called remap . Which provides declarative mapping. It's super easy to use and really will boost you productivity. So Let's get started!