MacOS: Opening a Terminal from a folder in Finder (plus, taking and annotating screenshots)

In Windows I like that you can Shift-Rightclick in Explorer and select “Open command prompt here”. During development I often want to do the same on my Mac, and this feature is provided too, but not enabled by default. To turn it on, go to System Preferences > Keyboard > Shortcuts, select Services on the left, and then check the option “New Terminal at Folder”:

If you want to go in the other direction, you can easily open a Finder at your current folder in Terminal by running ‘open .’

A couple of bonus tips:

  • To take full screen screenshot on the Mac, press Shift-Cmd-3. A file will be saved on your desktop. To take a screenshot of a selection of the screen, press Shift-Cmd-4, then drag to outline your selection.
  • In the Preview app, there’s a neat feature under Tools > Annotate where you can annotate your screenshots with highlighted sections, boxes, arrows, text etc. Just open your screenshot file in Preview, and then you can easily annotate and save the image:

Adding Spring Boot Actuator Metrics to a Jersey App

Spring Boot Actuator adds a number of health monitoring endpoints to support monitoring of your Spring Boot based applications. To add to an existing Spring Boot app, you just add a dependency on spring-boot-starter-actuator as described here.

This works out of the box for a Spring MVC based Spring Boot app, but if you’re building JAX-RS endpoints using Jersey, by default the Jersey resources and Actuator resources both get mapped to the root ( / ), so you need to map either Jersey or Actuator to something other than /. You can easily re-map Actuator be adding this line to application.properties (change /system as needed):

server.servlet-path=/system

This is described here: http://docs.spring.io/spring-boot/docs/current/reference/html/howto-actuator.html#howto-use-actuator-with-jersey