Washington (CNN) Former Deputy Attorney General Rod Rosenstein told graduating law students on Monday that they'll "face pressure to compromise on things that matter most" in a commencement address that hinted at his rocky tenure at the Justice Department.

Rosenstein's address was peppered with quotes from famous philosophers and presidents, and even special counsel Robert Mueller , the former FBI director who led the Russia investigation. Rosenstein oversaw Mueller's work for almost his entire term as deputy attorney general.

He spoke at the University of Baltimore Law School about the challenges facing young lawyers and reflected on his 29-year career of government service at the Justice Department.

"We live in a messy, contentious democracy, and democracy is built on compromise," he said.

Rosenstein continued, "You need to be prepared to compromise when you can do so without violating your principles. Of course, you will face pressure to compromise on things that matter most, perhaps even to trade virtue for the appearance of virtue. But you should exercise caution when circumstances tempt you to disregard principles."