Spring Boot 2 generic JPA converter to encrypt and decrypt an entity attribute

1 · Sunit Katkar · April 25, 2018, 9:45 p.m.
A recent requirement in my work mandated that certain columns in a table be encrypted when stored in the database. One can use the javax.crypto package from the standard JDK to achieve this by writing service layer code to encrypt and decrypt data for each entity attribute (table column) that required it.The entire code-base is built using Spring Boot 2 and JPA (Hibernate), so I was looking for a way to achieve the encryption and decryption without having to write code for each entity attribute....