design pattern examples in java with use of spring