If there’s one thing I’ve learned over the years, speed beats best intentions. The more things you can automate away, the more time you can focus on delivering business value. At the end of the day, that’s what will effect the bottom line.
When I build applications, my backend is always running Spring Boot. It’s my goto in all applications that I write. It’s stable, it’s fast, it performs well. The Spring team has done an excellent job of putting together the basic building blocks that allow me to stand up a new app with minimal fuss.
If I had to give you some words of wisdom when writing Spring Boot apps, I wood say, adopt their excellent use of starter dependencies and build your own. These days, most apps that I write have only 2 or 3 dependencies because I’ve put together my own starters.
I’ve created a parent starter POM which provides dependency management, plugin management and build profiles. By simply setting this as the parent in a new project, I get a lot of the functionality I want out of the box. This is similar to using the
spring-boot-starter-parent. I also have another starter which provides some infrastructure that I pretty much need in all of my apps, as well as any of the Spring Boot starter dependencies I always need. For some of the less common features this starter provides, I only enable them when passing a particular profile name to
spring.profiles.active when running the app.
I have another starter which provides data access. This starter contains all my entities, repositories and services, as well as auto configuration classes via
spring.factories and I enable them with bean profiles. In a previous post I spoke briefly about why I do this. I even have a security starter which not only brings in the Spring Boot security starter, but also sets up the infrastructure I need for authenticating users against a central database. By merely including that starter, I add authentication to my app. I can then add some customizations, such as specifying what role is required to access the app.
Frontend Maven Plugin
If you delve into the code, you’ll find where I’ve configured the frontend-maven-plugin. It basically boils down to 3 executions. First it installs node and npm into the working directory, so you don’t need them preinstalled if you’re building on a remote server. Second it installs all the npm dependencies defined in
package.json. Lastly it runs the
build script defined in
package.json. This plugin lends itself nicely to automated builds since it will always rebuild the UI code at the same time the application distribution is built without requiring additional infrastructure in place. You can find more information on this plugin from its GitHub page.
Other Tools of the Trade
- IntelliJ IDEA Ultimate - Probably one of my best investments in terms of productivity.
- Docker - When I feel like being one of the cool kids.
- GitLab - Because free private repos are awesome.
- Atom - Everyone needs a high performance text editor with plugins.
- Jekyll - Because why not? Check out my other article on moving my blog to Jekyll..