There are different possibility to use the UART under Interrupt, for instance use PRINTF but this mode use a loot of code or, more efficiency is to use the Call Back.
In this example we use the Call Back modality.
This project was tested on NUCLEO-F030R8, was developed using the Cube-MX and the project is for ATOLLIC.
Thanks to Cube-MX is easy move this project on other STM32 mcu but also generate the same project for other IDE (KEIL, IAR, etc)
For use this project connect the NUCLEO-F030R8 to PC and use a terminal emulator, we suggest TeraTerm.
This because the USART2 is transferred to the PC like a USB virtual com port.
For reading more, click here.