One of the great things about Spring Data Repositories is that they provide a number of query methods out of the box, with the ability to add additional queries simply by adding carefully named methods to the interface, and Spring generates the actual implementation for you. Sometimes, though, you do need to color outside the lines a bit. Thankfully, Spring allows us to do this. You just have to ask it nicely. Here’s now.
Thanks to haste and some sloppy copy-and-paste, today I deleted the wrong remote Git branch. There’s nothing like learning in a panic, but that’s what happened. Here’s what I learned on how to fix that.
The Red Hat twitter account just asked this question: "Communities grow by uplifting others. What is one piece of advice you’d offer to a new developer? Reply below and then check out some advice from #RedHatter @somalley108." Here’s my input.
As a general rule, if you’re writing software, you’re probably pretty intelligent. That intelligence, while important, of course, can also become a hindrance. For example, I’ve been told by coworkers, "You may write buggy code, but I don’t" and "We don’t need techincal oversight". I think both of those statements are patently false, and they — and others like them — always take me back to that advice from my first manager, Chris Anderson, gave me way back in 1997:
Check your ego at the door.
It’s really easy to walk in to a coding review, a design session, or one of a myriad of other meetings with your ideas and think they’re the best. It’s also really easy to overlook the fact that other people in that room are also pretty intelligent — maybe even more so (it happens), and that we all have blindspots and weaknesses. In my experience, and I’ve certainly been on both sides more than I care to admit, many conflicts in software development are ego-driven. There’s a difference between being passionate about something and being an arrogant jerk. The latter type does nobody any good, so check your ego. Go in humbly, and see what there is to learn from your coworkers, even if you’re more senior than they. With that mindset, everyone will come out a winner.
The project I’m working on is using Mockk in the unit tests. It’s a great library that has made true unit testing so much easier. I ran into a problem, though, where I needed a method I was mocking to return the value it was receiving. To be more specific, we were passing an object to a Spring repository method that had been built inside the method to test, and, to test thoroughly, I needed to get to that object. Turns out, that’s pretty easy to do with Mockk. Let’s take a look…
A user in #kotlin on Freenode asked how to run a Kotlin script. While the Kotlin docs are pretty clear on how to do that, I thought I’d make a quick post to show how to make an easily executable Kotlin script.
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.
I recently found myself writing a test that needed a database. Unfortunately, our testing database, H2, doesn’t support all of the features of our production database, PostgreSQL. This meant that the Flyway migrates used to manage the production database broke in the testing environment. The fix for this turned out to be pretty simple.
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. :)
- Tips for Writing Pluggable Java EE Applications
- JSFTemplating and Woodstock: Component Authoring Made Easy
- Jason Lee in depth: Mojarra and Scales
- Jason Lee: Postmortem for JavaOne 2008
- International Environmental: A Cooling Company Which Prefers Hot Software
- IEC donates custom JSF component to Mojarra Scales