When I define bellow controller in my app context I'm getting duplicate errors when I try to use it.
How do I pass the constructor-args to the controller without getting duplicate error messages?
My application context:
<context:component-scan base-package="org.brickred.socialauth.spring.controller" />
<bean id="socialAuthWebController" class="org.brickred.socialauth.spring.controller.SocialAuthWebController">
<constructor-arg value="http://www.mysite.com/" />
<constructor-arg value="/authSuccess.html" />
<constructor-arg value="/failed.html" />
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
The annotated controller:
@Controller
@RequestMapping("/socialauth")
public class SocialAuthWebController {
private String baseCallbackUrl;
private String successPageURL;
private String accessDeniedPageURL;
@Autowired
private SocialAuthTemplate socialAuthTemplate;
@Autowired
private SocialAuthManager socialAuthManager;
private final Log LOG = LogFactory.getLog(getClass());
/**
* Constructs a SocialAuthWebController.
*
* @param applicationUrl
* the base URL for this application (with context e.g
* http://opensource.brickred.com/socialauthdemo, used to
* construct the callback URL passed to the providers
* @param successPageURL
* the URL of success page or controller, where you want to
* access sign in user details like profile, contacts etc.
* @param accessDeniedPageURL
* the URL of page where you want to redirect when user denied
* the permission.
*/
@Inject
public SocialAuthWebController(final String applicationUrl,
final String successPageURL, final String accessDeniedPageURL) {
this.baseCallbackUrl = applicationUrl;
this.successPageURL = successPageURL;
this.accessDeniedPageURL = accessDeniedPageURL;
}
...
rest of the source code at http://code.google.com/p/socialauth/source/browse/trunk/socialauth-spring/src/org/brickred/socialauth/spring/controller/SocialAuthWebController.java
I get following error:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'socialAuthWebController' defined in URL [jar:file://Tomcat%207.0/webapps/ROOT/WEB-INF/lib/socialauth-spring-2.0-beta2.jar!/org/brickred/socialauth/spring/controller/SocialAuthWebController.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.lang.String]: : No matching bean of type [java.lang.String] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [java.lang.String] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}