Build layered memory systems with Java, Spring AI, PostgreSQL, pgvector, and scalable backend architecture