Posts tagged with java

  • Dropwizard with Immutables

    Oct 11, 2020

    In this post, I’m using Dropwizard together with the Immutables library and sharing some thoughts on OOP.

  • Troubleshooting java.lang.VerifyError

    Feb 29, 2020

    Yesterday I got an exception I hadn’t seen before, java.lang.VerifyError.

  • SDKMAN! on Windows

    Dec 7, 2019

    SDKMAN! manages multiple versions of Java related SDKs. In its homepage, it says it runs on any UNIX based platform, but I gave it a try on Windows and it works quite fine there too.

  • Testing null, empty, blank

    Sep 14, 2019

    In many cases, when you have a method that accepts a mandatory string parameter, you want to verify that the parameter contains a value that isn’t null, nor empty, not blank (i.e. consisting solely of whitespace characters). While writing the check is easy, testing it can be a bit annoying.

  • Optional files in Maven archetypes

    Sep 7, 2019

    This post shows how to create a Maven archetype that can conditionally include or exclude files while generating a project.

  • A CLI comparison of Java, JavaScript and Python

    Mar 16, 2019

    The inspiration for this post is the Python, Ruby, and Golang: A Command-Line Application Comparison published on Real Python.

  • clang-format as a git filter

    Jan 27, 2019

    clang-format is a tool that can format source code of C-like languages (C / C++ / Java / JavaScript / Objective-C / Protobuf). It supports various presets but it is also possible to fine tune its behavior with a configuration file named .clang-format. It has quite a lot configuration options.

  • YAML schema validation with Maven

    Nov 28, 2018

    Sometimes it feels we’re reinventing the wheel, but with different names. Back in the days, XML was the cool thing. We had XPath as a query language. We had XSLT to transform XML documents into different shapes. We had XSD to validate the schema of XML. We had code generation and validation. We could generate web service clients and servers with WSDL.

  • Upgrading Dependencies

    Nov 4, 2018

    This page shows how to upgrade dependencies in various programming languages and dependency management systems.

  • Troubleshooting SSL - missing /root/.postgresql/root.crt

    Nov 2, 2018

    I run into a problem today trying to connect to an Azure PostgreSQL database. The database enforces SSL connections (“SSL enforce status” = “ENABLED”).

  • Merging Swagger files

    Oct 28, 2018

    Consider the following scenario. You have a few microservices and they’re all developed independently: they don’t share code, they don’t share data and they don’t share schema. They’re all exposing their own REST API. To make things a bit simple, their API is defined in a swagger file.

  • Code coverage on integration tests?

    Aug 11, 2018

    Should you collect and measure code coverage on integration tests or only unit tests? In this post I’ll share some thoughts on this topic.

  • Using Spring Boot Actuators

    Jul 7, 2018

    Implementing Spring Boot actuators is not very difficult. In this post I’ll show what you can get for free, without adding any code.

  • Swagger and MapStruct

    Apr 29, 2018

    I’ve been working lately on a project with a few services (or microservices, if you like to play buzzword bingo). I wanted to share some thoughts on how using Swagger together with MapStruct can make things easier.

  • AssertJ cheatsheet

    Apr 22, 2018

    AssertJ is a an assertions library for unit tests in Java that is well worth considering. Here are some examples.

  • Using swagger code generator with maven

    Apr 21, 2018

    Following up the previous post about swagger, in this post I’m using the maven plugin version of swagger code generator.

  • Generate PNG barcode

    Apr 21, 2018

    How to generate PNG barcodes in Java using the zxing library:

  • Copy InputStream to OutputStream

    Apr 21, 2018

    To copy from a stream into a file:

  • Exclude class from JaCoCo coverage

    Apr 21, 2018

    JaCoCo’s exclude configuration works with classes, so the .class extension is important when specifying the path.

  • Building a REST API with Swagger and Spring Boot

    Apr 15, 2018

    In this post, I’ll be using Swagger to build a REST API with Java and Spring Boot. Swagger is an API framework. It uses a YAML-based language to define an API and it has a code generator that supports multiple languages.

  • Validate filename conventions with Maven Enforcer plugin

    Apr 17, 2017

    In this post I’m using the Maven Enforcer plugin to break the build when certain files don’t follow the expected naming convention. It’s always a good idea to take the time and implement these checks inside the build pipeline. The alternative is hoping that code reviewers will spot the problems, which is a manual, tedious and error prone approach. Automate all the things!

  • Debugging Docker with IntelliJ IDEA

    Mar 26, 2017

    In this post we’ll create a small Java application, run it inside a Docker container, and use IntelliJ IDEA to debug. This is a rather large post, so take your time.

  • Linting with Checkstyle

    Mar 12, 2017

    Code is going to be written once but read many times. A consistent coding style across the entire code base is important to increase readability and maintainability. Luckily, there are tools that can help to define and enforce such styling rules. From mere cosmetics up to nasty code smells, static code analysis can help increase the quality of your code. I wrote some posts on static code analysis in JavaScript a bit more than a year ago (which in the JavaScript world means the tools are now different, ESLint instead of JSCS/JSHint). In this post we’ll see the Checkstyle tool in the Java world, how to use it with TeamCity and IntelliJ and finally a few words about SonarQube.

  • Code Coverage with JaCoCo

    Mar 12, 2017

    Code Coverage is a useful set of metrics that show you how much of your code you’re impacting during testing. It doesn’t say much about the quality of your tests (you can read more in the old post What is code coverage?), but a 30% coverage is definitely worse than 90%. Let’s see how we can use JaCoCo to see our code coverage in the Java world. We’ll check a few options to use it, such as using it manually, using it within a CI, breaking the build with it, etc. The assumption is we’re working with a Maven project.

  • A quickstart Maven archetype for Java 8

    Feb 25, 2017

    As a Maven rookie, I often use the quickstart archetype from Maven when I want to create a new Maven project. Unfortunately, that archetype is a bit outdated, which means I have to tweak some details before I can actually use it. I guess I got a bit tired of this and I thought I could create my own archetype that is ready to use.

  • How to create a simple web app with maven

    Sep 18, 2016

    This post shows how to create a simple web application with maven.

  • Maven Tips

    Jun 14, 2015

    I started using Maven at work recently. Being a newbie, I find myself googling constantly (even though the answer is always on StackOverflow) about basic things. For reference, these are my most needed actions so far:

  • Log of today

    Oct 16, 2013

    So, this is a small summary of some things I did today (after all blog stands for web log):

  • Nested classes: Java vs C#

    Oct 8, 2013

    So I have started reading up on Java. Getting reacquainted with that old friend. Playing with swing components on the UI editor of NetBeans. Reliving the horror of having to declare every exception your method might throw. The ugliness of the XML DOM API. object.setNumber(object.getNumber() + 1) and so on and so on.

  • Learn Java again

    Sep 24, 2013

    I’ve been doing .NET for a long time. I started working on it exactly when .NET 2 was out, so I was lucky to avoid .NET 1 (almost) completely. I love .NET and C#. I think it’s not a coincidence that the main person behind it is the same person who was behind my favorite products when I was a teenage coder: Turbo Pascal, Object Pascal and Delphi. There is some sort of inexpressible similarity, I think, that reflects the designer’s choices in the framework and the language.

This site uses third party cookies from Google Analytics and Google AdSense Accept and close popup