refactor code to allow gretty support
spring security config