-
Jackson, JAXB, OpenAPI and Spring
Imagine that you have a service that enriches some data. The model for the data that needs to be enriched is generated from an XSD. The model for the enriching data (the wrapper) is generated from OpenAPI specs. Those two separate models need to be combined and sent out via Spring’s RestTemplate. The problem is…
-
Rich Domain vs. Structs & Services
When joining a project, you have to work with the code that you’re given. It’s only when you start to understand the project that you can start to change the way the problems are being solved. Most projects that I’ve joined use an object oriented language, but not all projects use object oriented principles. In…
-
Boxes
When I started university, I told myself to save all my projects. That way I could create a library of useful bits that I could use in later projects. That was nearly a quarter of a century ago. Since then I’ve collected a projects folder of about 20 GB. This contains lots of duplicates, special…
-
Java XML Api
Who uses XML in 2021? We all use JSON these days, aren’t we? Well, it turns out XML is still being used. These code fragments could help get you up to speed when you’re new to the Java XML API. Create an empty XML document To start from scratch, you’ll need to create an empty…
-
Can you solve this puzzle?
Every once in a while, I come across this little puzzle. I have no idea who made it, or what the intended answer is. Usually there are a lot of people giving the same answer. And although that answer is reasonable, I don’t think it’s correct. When we modify the calculation to (x * y)…
-
Leveraging Lucene
Imagine a catalog of a few hundred thousand items. These items have been labeled into a few hundred categories. Each item can be linked to up to three categories. New categories need to be added in order to make things easier to find. However, categories without content are useless. So some content needs to be…
-
Be agile, don’t do “Agile”
Over the last decade I’ve been involved in several projects that are doing Agile. Most of them were using Scrum, and most of them didn’t really deliver what was promised. The promise of Scrum is that the team delivers more value, but what it actually delivers is more reporting tools and ceremonies to keep managers…
-
Spring Boot, MongoDB and raw JSON
Sometimes you want to store and retrieve raw JSON in MongoDB. With Spring Boot storing the JSON isn’t very hard, but retrieving can be a bit more challenging. Setting up To start using MongoDB from Spring Boot, you add the dependency to spring-boot-starter-data-mongodb And then you inject MongoTemplate into your class Inserting into MongoDB Inserting…
-
Lessons learned
Pressure makes diamonds, as the saying goes. I worked on a high-pressure project for a couple of weeks (as in, it needed to be done before we even started), and these are some of the lessons we learned as a team. The lessons are mostly tips and tricks, as we learned a lot on the…
-
JVMCon
On 30 January 2018, the first edition of JVMCon was organised. It was a small conference, only a couple of hundred attendees, but it was sold-out anyway. I attended five sessions, and I will list them in order of least to most awesome. The first session I attended was by Alexander Yadayadayada (his joke, not…