Another issue could be that the name of the class is different from that in the SpringApplication.run() argument, this was the case for me.
public class Chat {
public static void main(String[] args) {
SpringApplication.run(WebSocketConfig.class, args);
}
}