I am trying to override the default behavior of Spring Social to redirect to "connect / {providerId} Connected" after connecting to the provider (Twitter, Facebook, etc.).
So I am trying to override the default behavior by overriding the protected java.lang.String connectedView (java.lang.String providerId) method
So, I subclassed ConnectController and tried to override:
@Controller public class CustomConnectController extends ConnectController{ @Inject public CustomConnectController( ConnectionFactoryLocator connectionFactoryLocator, ConnectionRepository connectionRepository) { super(connectionFactoryLocator, connectionRepository); } @Override protected String connectedView(String providerId){
See controller class documentation: http://static.springsource.org/spring-social/docs/1.0.x/api/org/springframework/social/connect/web/ConnectController.html
But I get the following error:
Called: java.lang.IllegalStateException: An ambiguous mapping was detected. Cannot match '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) in {[/ Connect / {providerId}], methods = [POST], PARAMS = [], headers = [], consumes = [], produces = [], custom = []}: The customConnectController bean method already exists public org.springframework.web.servlet.view.RedirectView org.springframework.social.connect.web.ConnectController.connect (java.lang.String, org.springframework.web.context .request.NativeWebRequest) are mapped.
Someone can advise. My requirement is as follows: 1. After the user connects to the social account (Twitter, Facebook, etc.), 2. Do some business logic 3. Redirect to the / foo / bar page
Please, help.
source share