I'm trying to override the default behavior of Spring Social to redirect to "connect/{providerId}Connected" once connected to a provider (Twitter, Facebook etc).
So I'm trying to override the default behavior by overriding the method protected java.lang.String connectedView(java.lang.String providerId)
So I've subclassed ConnectController and tried overriding:
@Controller
public class CustomConnectController extends ConnectController{
@Inject
public CustomConnectController(
ConnectionFactoryLocator connectionFactoryLocator,
ConnectionRepository connectionRepository) {
super(connectionFactoryLocator, connectionRepository);
}
@Override
protected String connectedView(String providerId){
//Do some logic
return "redirect:/foo/bar;
}
}
See documentation of the controller class: http://static.springsource.org/spring-social/docs/1.0.x/api/org/springframework/social/connect/web/ConnectController.html
But I get the following error:
Caused by: java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'org.springframework.social.connect.web.ConnectController#0' bean method public org.springframework.web.servlet.view.RedirectView org.springframework.social.connect.web.ConnectController.connect(java.lang.String,org.springframework.web.context.request.NativeWebRequest) to {[/connect/{providerId}],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}: There is already 'customConnectController' bean method public org.springframework.web.servlet.view.RedirectView org.springframework.social.connect.web.ConnectController.connect(java.lang.String,org.springframework.web.context.request.NativeWebRequest) mapped.
Can anyone please guide. My requirement is as follows: 1. After user connects social account (Twitter, Facebook etc) 2. Do some business logic 3. Redirect to /foo/bar page
Please help.