How do you configure Spring Security to secure REST APIs, and how does it integrate with Hibernate for database transaction management?