context.registerShutdownHook();
final Scanner scanner = new Scanner(System.in);
final BusinessService service = context.getBean(BusinessService.class);
if (LOGGER.isInfoEnabled()) {
LOGGER.info("\n========================================================="
+ "\n "
+ "\n Please press 'q + Enter' to quit the application. "
+ "\n "
+ "\n=========================================================" );
}
System.out.print("Please enter a string and press <enter>: ");
final String key = "hello";
while (true) {
final String data = scanner.nextLine();
if("q".equals(data.trim())) {
break;
}
try {
System.out.println(String.format("Persisting String: '%s' with key '%s'.", data, key));
service.saveData(key, data);
} catch (Exception e) {
LOGGER.error("An exception was caught: " + e);
}