A while back I had to make some changes to a couple of existing microservices that were new to me. People would always refer to any of them only by the name of the bounded context that they were a part of: the Message Center.
Not sure where to find the repositories, I searched for message center in gitlab thinking there should be a project, folder, repo, or something like that. But alas, I was unable to find anything.
Continue reading “Grouping multiple repositories with git submodules”
This year I’ve had the honor of presenting a session at Devoxx Belgium together with my colleague Jeroen Burggraaf.
On Thursday, 10th November we gave a short presentation about JSR 354 – the Money and Currency API.
The presentation was well received by the public. A registration of the talk can be found on Slideshare and YouTube.
A while ago, I had to write a polling service in AngularJS. For this service, there were three main requirements:
- poll the backend every x ms until the expected result has been attained
- the service has to timeout after a set period of time
- one should be able to stop the polling
Continue reading “AngularJS polling service”
There are times when you’re unit testing code that is making HTTP calls to a remote server. You could be using a library such as Apache’sHttpClient or Spring’s RestTemplate to do so.
Of course, you don’t want to rely on a remote service for your unit tests. Besides the overhead involved (remember that unit test are supposed to be fast) you simply cannot rely on remote services being available during execution of your tests. You probably are also not able to completely control the response for all of your test scenarios.
Continue reading “Unit testing HTTP calls with LocalTestServer”
A couple of weeks ago I was very fortunate to be able to attend the excellent GOTO Amsterdam conference. One of the tracks was all about microservices and since the company that I’ve been working for as a contractor for the last year is struggling to move to a (micro)service architecture, of course I just had to attend most of that particular track.
Continue reading “Don’t jump on the microservices bandwagon”
This post will illustrate a way in which exception handling can be implemented for RESTful web services in Spring in such a manner that the exception handling concerns are separated from the application logic.
Continue reading “RESTful Error Handling with Spring”
The ANSI SQL 1999 standard introduced a BOOLEAN data type (although unfortunately only as an optional feature). But to date it still isn’t implemented by most major database systems. As a consequence boolean columns are implemented in various ways. E.g., CHAR columns containing ‘Y’ or ‘N’, or using BIT columns. Subsequently, there is no way for JPA to provide a standardized way of mapping an entity’s boolean fields onto database columns.
Hibernate offers a custom YesNoType for boolean implementations using CHAR(1) columns containing ‘Y’ or ’N’ characters. But for other practices you basically have to provide your own solution. Fortunately, Hibernate offers the possibility of creating your own custom UserType’s. In this blog entry I will give an example of one such custom Boolean UserType. Continue reading “Custom Boolean User Type with Hibernate JPA”
Whenever you’re using JAX-WS within Spring you’ll probably want to log the incoming and outgoing SOAP messages – if only for debugging during development. So the first thing to do is increase the log levels, right? Unfortunately this will have no effect. What you will have to do is to make use of the
javax.xml.ws.handler.HandlerResolver interface. So how do we do this?
Continue reading “Logging JAX-WS SOAP messages in Spring”
Lately, I’ve been writing alot of RESTful services using the Spring framework and its @RestController. The only thing I really missed was an easy way to document the RESTful API. I’ve looked into various options, and like most people, I found that Swagger seemed to be the only viable option. However, after having tried it, I found some serious issues. Besides being a very bulky dependency to have to include, having a visually attractive but very cluttered front-end in the form of SwaggerUI, what I disliked the most was the pollution of my code with alot of additional annotations.
Continue reading “Documenting Spring RESTful APIs”
For the last year or so, I’ve been struggling with what Martin Fowler calls the Anemic Domain Model. The development teams at one of my clients, employ Java in a fashion where OO concepts are sometimes hard to find. Java objects are used as mere dataholders and business logic is scattered all around the place but mostly concentrated inside stored procedures. It also doesn’t help that alot of frameworks and libraries used nowadays, such as JPA/hibernate, Jackson, etc., rely heavily on the JavaBeans specifications thereby inadvertently encouraging the Anemic Domain Model anti-pattern.
Continue reading “Implementing Domain-Driven Design book review”