春天社交版1.1.0.RELEASE,我需要建立applicationUrl爲ProviderSignInController,我的應用程序(一個Tomcat應用程序)在代理(Apache Web服務器)託管。根據Spring Social document,我將它設置如下:春天社會applicationURL設置例外
<bean id="providerSignInController"
class="org.springframework.social.connect.web.ProviderSignInController">
<property name="signInUrl" value="/accounts/login" />
<property name="signUpUrl" value="/accounts/signup" />
<property name="postSignInUrl" value="/accounts/profile" />
<property name="applicationUrl" value="${applicationUrl}" />
</bean>
但是,部署應用程序時,我得到在Tomcat中的異常catalina.out中說:
PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property
'applicationUrl' threw exception; nested exception is
java.lang.NullPointerException>org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0'
defined in ServletContext resource [/WEB-INF/spring-servlet.xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'providerSignInController' defined in ServletContext
resource [/WEB-INF/spring-servlet.xml]: Error setting property values;
nested exception is
org.springframework.beans.PropertyBatchUpdateException; nested
PropertyAccessExceptions (1) are:
PropertyAccessException 1:
org.springframework.beans.MethodInvocationException: Property
'applicationUrl' threw exception; nested exception is
java.lang.NullPointerException
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
任何建議嗎?謝謝。
你已經在你的屬性中設置了'applicationUrl'嗎? – 2015-04-04 16:10:09
是,所推薦的春天社會文檔(http://docs.spring.io/spring-social/docs/1.1.0.RELEASE/reference/htmlsingle/#enabling-provider-sign-in-with-code- providersignincontroller-code),應用程序URL的值在屬性文件中被外化。順便說一句,如果我沒有在bean providerSignInController的聲明中設置property applicationUrl,那麼可以毫無問題地創建bean。也就是說,屬性signInUrl,signUpUrl和postSignInUrl沒有問題。 – Yuci 2015-04-05 21:50:18
然後,你能不能告訴我們的屬性文件,以及如何配置讀取屬性文件的春天嗎?以及其他屬性(如signInUrl,signUpUrl)沒有任何問題,因爲您直接設置這些值。 – 2015-04-06 03:40:36