star wars the force awakens trailer
John Boyega donning an imperial stormtropper outfit Disney/Lucasfilm

Star wars actor John Boyega has responded to racist attacks on social media following his appearance as a stormtrooper in the new Star Wars trailer: The Force Awakens.

"To whom it may concern... Get used to it :)" he wrote on Instagram.

The 88-second teaser trailer, which has already had more than 40 million views, opens with Boyega perspiring and out of breath, appearing to be in danger in the desert of Tatooine the homeland of Luke Skywalker and Darth Vader.

His appearance as a black stormtrooper was criticised heavily on social media over the weekend to the disgust of many people on Twitter, which started #blackstormtrooper as a trending debate.

But the 22-year-old actor did not seem particularly phased by the outcry, telling critics on Instagram to "get used to it" and thanked everyone who had supported him. He expressed his excitement at being part of the film, which is out in December 2015.