President Trump took on his media critics Wednesday toward the end of a commencement address at the U.S. Coast Guard Academy, telling the graduating class not to let the “naysayers get in the way of your dreams.”

Trump’s speech at the USCG Academy in New London, Conn., was his second address of the 2017 graduation season, and the first public appearance since new allegations concerning the Russia probe surfaced.

Trump’s address, thanking the class for their service, also included some “advice,” which echoed the same approach he applied to his campaign and his presidency.

“Over the course of your life, you will find that things are not always fair and that things happen to you that you do not deserve, and that are not always warranted, but you have to put your head down and fight, fight, fight,” Trump said, saying that “no politician in history has been treated worse or more unfairly” by the media.

His comments drew audience laughter.

“Adversity makes you stronger—don’t give in and don’t back down and never stop doing what you know is right,” Trump said. “Nothing worth doing ever, ever, ever comes easy—the more righteous your fight, the more opposition you’ll face.”

The comments come after The New York Times published a report claiming that a memo from James Comey said the president asked the former FBI chief back in February to end the probe of former national security adviser Mike Flynn.

The White House has disputed the report, while Democrats have seized on it to bolster calls for a special prosecutor.

Trump's speech Wednesday hit his media coverage without explicitly referencing the latest controversy.

Trump’s speech also touted the administration’s “tremendous” accomplishments in his “short time” as president, nodding to the historic decrease in border crossings and the preparation for construction of “the wall” along the U.S.-Mexico border. Trump thanked Homeland Security Secretary John Kelly, who made brief remarks at the commencement before Trump took the stage.

"I've loosened up the strangling environmental chains wrapped around our country and our economy--chains so tight you, you couldn't do anything," he said, touting jobs that "are pouring in" and a tax reform proposal to give "the largest tax cut in the history of our country."

Trump also added Supreme Court Justice Neil Gorsuch to his list of accomplishments, and said that he "saved the Second Amendment."

“We are setting the stage for more things to come—the people understand what I’m doing and that’s the most important thing,” Trump said, adding that veterans will be taken care of. “I didn’t get elected to serve the Washington media—I got elected to serve the forgotten men and women and that’s exactly what I’m doing.”

Trump also mentioned his first foreign trip at the end of this week, calling it a “crucial journey” to strengthen relationships with partners, with the safety and security of Americans as his first priority, saying: “I will strengthen all friendship with partners who will also help us, not to take and take and take, but partners who help for whatever we are doing and all of the good we are doing for them.”