我正在从https://github.com/OhadR/Authentication-Flows开发相同的代码(基本上寻找Spring MVC应用程序来重置密码或忘记密码或锁定密码功能)
经过研究,我发现这个网址很棒,但是当尝试在Tomcat Web服务器上编译和部署代码时会导致以下错误:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authFlowsProperties': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.ohadr.auth_flows.config.AuthFlowsProperties.accountActivatedEndpointUrl; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'com.ohadr.auth-flows.endpoints.accountActivatedEndpointUrl'
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5262)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5550)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.ohadr.auth_flows.config.AuthFlowsProperties.accountActivatedEndpointUrl; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'com.ohadr.auth-flows.endpoints.accountActivatedEndpointUrl'
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:506)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284)
... 29 more
我用过的pom.xml?仍然OhadR需要更新pom.xml
<properties>
<ohadr.spring.version>4.0.9.RELEASE</ohadr.spring.version>
<ohadr.spring.security.version>3.2.7.RELEASE</ohadr.spring.security.version>
<ohadr.flows.version>1.6.2-SNAPSHOT</ohadr.flows.version>
</properties>
<dependencies>
<dependency>
<groupId>com.ohadr</groupId>
<artifactId>authentication-flows</artifactId>
<version>${ohadr.flows.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.0.9.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${ohadr.spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${ohadr.spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${ohadr.spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${ohadr.spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${ohadr.spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${ohadr.spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${ohadr.spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${ohadr.spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${ohadr.spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${ohadr.spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${ohadr.spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${ohadr.spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${ohadr.spring.version}</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.16</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!-- Pair impl -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
<!-- sending emails... -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.1</version>
</dependency>
</dependencies>
&#34; client.properties&#34; (正如ohadR所建议的那样)
com.ohadr.oauth2.db.username=root
com.ohadr.oauth2.db.password=root
com.ohadr.oauth2.db.host=localhost
com.ohadr.oauth2.db.port=3306
com.ohadr.oauth2.db.schema=test
com.ohadr.auth-flows.linksExpirationMinutes=60
com.ohadr.auth-flows.mail.username=ohadr.developer@gmail.com
com.ohadr.auth-flows.mail.password=*****
com.ohadr.auth-flows.isREST=false
com.ohadr.auth-flows.email.fromField=ohadr.com Admin
# Crypto settings
com.ohadr.crypto.keystore=C:/Ohad/Dev/Tools/ohad.ks
com.ohadr.crypto.password=kspass
com.ohadr.crypto.keyAlias=ohadr
com.ohadr.crypto.createKeystoreFileIfNotExist=false
com.ohadr.auth-flows.endpoints.accountActivatedEndpointUrl=/login/accountActivated.htm
答案 0 :(得分:1)
@prtk_shah在他的评论中是正确的 - 客户端应用程序应该在“client.properties”文件中添加几个属性。其中一个是
com.ohadr.auth-flows.endpoints.accountActivatedEndpointUrl
基本上这是控制器重定向到的URL,在帐户激活时(意味着,当用户单击他订阅后获得的验证电子邮件中的链接时)。此属性允许auth-flow是通用的,因为它不会强制客户端应用程序到特定的激活端点。因此,每个客户端应用程序都可以拥有自己的端点URL。例如,一个应用程序可以拥有此端点:/login/accountActivated.htm,而另一个应用程序可以使用此端点:/activatation.jsp
你完全正确;这被描述为here,也许它应该在the README of the auth-flows itself中。
<强>更新强>
顺便说一句,我看到你已经更新了你的问题并添加了你的client.properties文件。请注意, GitHub中的props文件只是一个示例,每个客户端应用程序都应该对其进行编辑,使其适合客户端应用程序。例如,我认为您用来向客户发送电子邮件的电子邮件地址不是ohadr.developer ...而且密码不是******。并且com.ohadr.crypto.keystore
应包含密钥库的真实路径(read this section)