Coming Up for Air

With my recent job change, I’ve gotten a chance to use Spring Boot in anger a bit. It’s been fun, and I’ve learned a fair bit about the current state of Spring (I still love you, Jakarta EE!). One of my tasks involved adding a query method to a repository, and I wanted to make sure the query worked before I pushed it upstream. To do that confidently, of course, required a unit test. In this post, I’ll show how remarkably simple it is to test Spring Repositories using Flyway to set up schemas and test data.

Development environments can get fairly complex, and making sure you’re using the right version of some library or another can be annoying on the best of days. I have a situation like that where my "day job" requires (still, and hopefully not for much longer) JDK 8, but my side projects, learning efforts, etc. can use a more modern version.

Years ago, Charles Nutter shared a shell script he uses to switch JDKs. I’ve been happily using it, but I’ve made some minor tweaks, so I thought I’d share my version here in case it helps someone (and make it easier for me to find in the future ;).

UPDATE: It seems the original author is Nick Sieger. Thanks to you as well, Nick, for a great little utility!

Recently, in the #kotlin channel on Freenode, a user asked a question about what was happening to his Java code when using IDEA’s convert-to-Kotlin functionality. He left before anyone had the time to answer, and while he likely doesn’t read my blog, I’m going to answer his question here anyway. :)

The Micronaut guides are really pretty good. So far, I’ve found just about everything I need. The biggest obstacle so far has been that, at times, the content was scattered across several guides and usually in the wrong language: I’m interested in Kotlin, but the guides seem to be mostly in Java or Groovy. This isn’t surprising, as budgets are limited, of course. What I would like to do here, then, is provide a small sample app, written in Kotlin, that demonstrates how to set up the project, configure and use JPA, and secure the app with JWT.

Recently, I’ve been experimenting with Micronaut, a new-ish "modern, JVM-based, full-stack framework for building modular, easily testable microservice and serverless applications" from the makers of Grail. So far, I’ve been really impressed. The documentation has been excellent, and the framework is very easy to get started with. I have, though, run in to some trouble writing tests, or, more accurately running tests. I spent far too much time trying to figure it out until I finally broke down and asked, and it turns out that it’s IDEA’s fault. While that’s a bit annoying, there is a workaround, which I’d like to document briefly here.

I hope you all have a merry Christmas. More importantly, I hope you take the time to think about the birth of the child that gives Christmas its meaning.

"The birth of Christ is the timeless event that leads us to believe that the cries of a broken world have actually been heard. A Savior has been born. The vault of Heaven truly has been opened" -- Author Unknown

This morning, I was asked a question by a coworker that we both thought we knew the answer to: if a method is protected, can other classes see that method? The answer surprised us: maybe. :) It’s a pretty simple, basic question, but I thought I’d mention it in case there’s a beginner wondering, or more senior developers, such as myself and my team mate, that just have it wrong. :)

Many times, one of the hardest parts of getting started with a particular piece of technology is figuring out how to get started. :) In this series, I’ve used an extremely simple project to show how to do just that with a number of MicroProfile implementations. Obviously, a real application will have many more concerns than we dealt with in this application, but what this effort gave us is working, runnable, and testable build for six different MicroProfile implementations. What I’d like to do in this final installment in the series, is give some closing thoughts.

Search

    Quotes

    Sample quote

    Quote source

    About

    My name is Jason Lee. I am a software developer living in the middle of Oklahoma. I’ve been a professional developer since 1997, using a variety of languages, including Java, Javascript, PHP, Python, Delphi, and even a bit of C#. I currently work for Red Hat on the WildFly/EAP team, where, among other things, I maintain integrations for some MicroProfile specs, OpenTelemetry, Micrometer, Jakarta Faces, and Bean Validation. (Full resume here. LinkedIn profile)

    I am the president of the Oklahoma City JUG, and an occasional speaker at the JUG and a variety of technical conferences.

    On the personal side, I’m active in my church, and enjoy bass guitar, running, fishing, and a variety of martial arts. I’m also married to a beautiful woman, and have two boys, who, thankfully, look like their mother.

    My Links

    Publications