Threads, concurrency, or synchronization are not very easy to understand concepts. When some concurrency is involved in our applications it’s pretty hard to avoid making mistakes. Although Java provides mechanisms to deal with parallel programming, sometimes there are just too many options. And often some essential options are missing. For web applications, Jakarta EE provides a simplified programming model to deal with parallel tasks. But in order to use it effectively and avoid mistakes, you need to understand the basic concepts which I’d like to explain here.(more…)
Since version 9, Java has new features every 6 months and it’s very hard to keep track of these new changes. Most of the information on the internet describes changes between the last 2 Java versions. However, if you’re in a similar situation as me, you’re not using one of the latest Java versions but a version several releases older.
Then it’s useful to know which new features were added since the version you use now, or between the versions that you use now and the one you want to start using next. Therefore I’ve compiled a table with all new features added since Java 8 for each new Java version.(more…)
The security before Java EE 8 / Jakarta EE 8 used to be a bit complicated and confusing. Every specification provided its own way to retrieve information about the logged-in user. The situation greatly improved with the introduction of the Security API that provides a unified way to do that – simply inject the SecurityContext CDI bean.(more…)
Jakarta REST (JAX-RS) defines it’s own dependency injection using the
@Context annotation. REST resources also support
CDI injection if you enable CDI on the REST resource class (e.g. using a bean-defining annotation like
But injection doesn’t work out of the box on JAX-RS sub-resources. How to create sub-resources so that both injection mechanisms work also in sub-resources? I’ll show you, it’s very easy.(more…)
EclipseCon conference is a great event for all Java developers, especially those who are passionate about and believe in opensource. The conference is scheduled for 26-28 October 2021. I wholeheartedly recommend to attend it. It’s a free online event, you just need to register to attend: https://www.eclipsecon.org/2021
Specifically for users of Jakarta EE it might be even more interesting to attend the Jakarta EE Community Day, which happens the day before the main conference on 25 October 2021. It’s open to all people that register for the main EclipseCon event. There’s a packed agenda centered on the Jakarta EE, MicroProfile and Cloud Native Java communities, including topics like the present and future of MicroProfile and Jakarta EE, and upcoming features in Jakarta Security, Jakarta Concurrency, Jakarta REST, and Jakarta NoSQL.
Recently, we had a discussion how to create a standalone Jakarta Batch test kit (TCK). For most of the committers, it’s pretty natural to use Arquillian to abstracts tests away from how they are executed on an implementation. But Romain proposed an intriguing idea to use plain JUnit5 that got me thinking. And it didn’t stop with thinking. After a few hours of hacking, I’m now able to present a proof of concept and suggest how we could use plain JUnit5 for the TCK and also how containers can be integrated with it using good old Arquillian to avoid reinventing the wheel.(more…)
Services can often be optimized with asynchronous processing even without changing their behavior towards the outside world. The reason why some services aren’t efficient is that they need to wait for other services to provide a result to continue further. Let’s look how to call external REST services without waiting for them and also do multiple parallel calls independently and combine their results later with a reactive pipeline in Java EE 8.(more…)
Answering Stackoverflow questions provides a great feedback for finding out gaps in the official documentation of my favourite opensource tools. One of the questions which I answered here was how to change Payara Server master password in docker container. Obviously, in a standard server installation, this is simple – just use the asadmin change-master-password command, then type the old and new password in to the console and it’s done. Not in docker though, where the configuration has to be automated by a script. The same applies to all infrastructure-as-a-code solutions like Chef or Puppet. So I had to dig deeper into the documentation and experiment a bit.(more…)
Last week, Oracle announced their intentions to open Java EE and transfer it to an open source foundation to continue its development in a more open way. I’ve been involved in some email discussions (here and here) and in a conference call organized by Oracle and I want to summarize what I know and expect in the future. I’m also a MicroProfile project member, so I’ll comment on its relation and future benefits to Java EE. (more…)