401 Unauthorized Request to Binance REST API

I am trying to send a test order in to test the HMAC signature generation but I am getting the following error back from the API

org.springframework.web.client.HttpClientErrorException$Unauthorized: 401 Unauthorized: [no body]

Below is the Java code I am using to call the REST API

public ResponseEntity<String> testOrder() {
Date date = new Date();
StringBuilder url = new StringBuilder();
url.append(BINANCE_API_BASE_URL)
    .append("/")
    .append(BINANCE_API_VERSION)
    .append("/")
    .append("order")
    .append("/")
    .append("test");
HttpHeaders headers = new HttpHeaders();
String body = "symbol=BTCUSD&timestamp=" + date.getTime();
byte[] hmac = HMAC.calcHmacSha256(apiKeysConfiguration.getSecretKey().getBytes(StandardCharsets.UTF_8), body.getBytes(StandardCharsets.UTF_8));
String signature = String.format("%032x", new BigInteger(1, hmac));
body = body + "&signature=" + signature;
System.out.println(body);
HttpEntity<String> entity = new HttpEntity<>(body, headers);

return restTemplate.exchange(url.toString(), POST, entity, String.class);

}

Quite a few things to correct. Please read this first - Where to start if I'm new to Binance API

Then you might want to use https://github.com/binance-exchange/binance-java-api as JAVA demo to start your journey