java - How to change the property signUpUrl in ProviderSignInController in Spring Boot -


in short

i need change property value of bean defined in auto configuration of spring boot, not available configure application.properties

descriptive

i want change signupurl of bean providersignincontroller. not available change in properties file according documentation.

http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

so did somthing this.

@configuration public class someconfig {      @autowired     public void configureprovidersignincontroller(providersignincontroller signincontroller){         signincontroller.setsignupurl("/register");     } 

and ended following error

caused by: org.springframework.beans.factory.nosuchbeandefinitionexception: no qualifying bean of type [org.springframework.social.connect.web.providersignincontroller] found dependency: expected @ least 1 bean qualifies autowire candidate dependency. dependency annotations: {}     @ org.springframework.beans.factory.support.defaultlistablebeanfactory.raisenosuchbeandefinitionexception(defaultlistablebeanfactory.java:1301)     @ org.springframework.beans.factory.support.defaultlistablebeanfactory.doresolvedependency(defaultlistablebeanfactory.java:1047)     @ org.springframework.beans.factory.support.defaultlistablebeanfactory.resolvedependency(defaultlistablebeanfactory.java:942) 

but according autoconfiguration bean should available

https://github.com/spring-projects/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/socialwebautoconfiguration.java

please , guild me if i'm doing incorrectly.

the error describes problem have not instantiated bean type of providersignincontroller in method signature configureprovidersignincontroller. instead, need instantiate , configure controller in 1 of configurations proper constructor signatures required controller:

@configuration @enablesocial public class socialconfig implements socialconfigurer {      ...      @bean     public providersignincontroller providersignincontroller(                 connectionfactorylocator connectionfactorylocator,                 usersconnectionrepository usersconnectionrepository) {         providersignincontroller controller = new providersignincontroller(             connectionfactorylocator, usersconnectionrepository,             new simplesigninadapter());         controller.setsignupurl("/register");         return controller;     }  } 

alternatively, if using xml configurations:

<bean class="org.springframework.social.connect.signin.web.providersignincontroller">     <!-- relies on by-type autowiring constructor-args -->     <property name="signupurl" value="/register" /> </bean> 

for more information, consult spring social docs on enabling provider sign in.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -