After I added @Configuration to SecurityConfig, it fixed my issue. The OauthSuccessHandler is getting invoked now. However, I am still not sure how the oauth flow worked before but only my OauthSuccessHandler failed to get invoked.
@Configuration
SecurityConfig