java

Building finite streams in Scala

Maybe you've already run into a scenario that you needed to create a finite stream of something that you have no idea about the size of it: a queue, a paged HTTP service, a database table, etc. Luckly for us, both Play! and Akka Stream provide an easy way to create and to handle this kind of stream. Consider you have the following function: def fetchTransactions(page: Int): Future[Seq[Transaction]] = //implementation here You need, somehow, build a report of transactions. There are A LOT of transactions and your machine…

Keep reading

Seven tips to be happy as a Java Developer (or at least less sad)

Most Java Developers still are trapped working in Banks. These developers cannot simply stop writing bureaucratic code. If you already identified yourself, unfortunately, this post isn't for you, I'm so sorry, you're completely lost, but don't worry, I'm pretty sure there's a special place in heaven for people like you. On the other hand, there are a few Java developers who could escape the agony of writing "enterprise" Java code and started writing Kotlin, Scala or even a non JVM language. If you are a developer like this…

Keep reading

Building microservices with Kotlin and Spring Boot

It's been a while since Kotlin arrived. Kotlin is a JVM language created by JetBrains developed to be interoperate with Java libraries and apis. What draws attention about Kotlin is its simplicity. If you find Java too verbose, you also will be interested in Kotlin because it is possible to transit between both languages easily. Okay then, this post is supposed to be very short, so, let's begin. We are going to build a simple crud app using Spring Boot, specifically Spring Boot Data Rest and use Kotlin (of course)…

Keep reading

Configuring multiple datasources using SpringBoot and Atomikos

Since I didn't find any article explaining how to use the auto configuration to configure Atomikos on SpringBoot, I decided to write this post. I hope it can be useful to someone. ;) Dependencies Assuming you are developing a web application and want to use Atomikos to provide distributed transactions over multiple datasources, you will need only two dependencies: def springBootVersion = 'YOUR_SPRING_BOOT_VERSION_HERE' compile group: 'org.springframework.boot', name: 'spring-boot-starter-jta-atomikos', version: springBootVersion compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springBootVersion The application.yml If you are using…

Keep reading

Why you should consider using Apache DeltaSpike

We always hear about the Spring vs Java EE fight. Do we always have to use one of them? For sure, they give you a lot of facilities, but, do we need all of those features that they bring with them every time? Well, actually you don't need to choose one of them always. There are a lot of other alternatives that help you build your applications, so, why not take a look at few of them? I'm here to show an alternative called Apache DeltaSpike. Apache DeltaSpike is a…

Keep reading