gpt4 book ai didi

java - 为 play 框架和 spring 定制 secureSocial(依赖注入(inject))

转载 作者:太空宇宙 更新时间:2023-11-04 07:12:28 25 4
gpt4 key购买 nike

我正在使用 Play 2.0.6 的安全社交版本 2.0.13 以及 play 和 spring。我从类型安全教程下载了项目模板,并使用 http://securesocial.ws/guide/getting-started.html 中的指南向其中添加了安全社交。然后我用我的版本替换了登录和模板,因为我需要没有注册的登录页面。因此,我将登录名及其模板复制到我的自定义包中,并从中删除了注册标签。问题是当我启动应用程序并请求 url 时,我遇到了此错误:

[error] play - Cannot invoke the action, eventually got an error: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [securesocial.core.java.SecureSocial$Secured] is defined[error] application -

! @6gfok11pe - Internal server error, for (GET) [/] ->
play.api.Application$$anon$1: Execution exception[[NoSuchBeanDefinitionException: No qualifying bean of type [securesocial.core.java.SecureSocial$Secured] is defined]]
at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10.jar:2.2.0]
at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10.jar:2.2.0]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.0]

at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun $applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.0]

at scala.Option.map(Option.scala:145) [scala-library.jar:na]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2.applyOrE lse(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.0]
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No q ualifying bean of type [securesocial.core.java.SecureSocial$Secured] is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListablBeanFactory.java:296) ~[spring-beans-3.2.3.RELEASE.jar:3.2.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1125) ~[spring-context-3.2.3.RELEASE.jar:3.2.3.RELEASE]
at AbstractGlobal.getControllerInstance(AbstractGlobal.java:29) ~[oul_2.10.jar:na]
at Global.getControllerInstance(Global.java:27) ~[classes/:na]
at play.core.j.JavaGlobalSettingsAdapter.getControllerInstance(JavaGlobalSettingsAdapter.scala:46) ~[play_2.10.jar:2.2.0]
at play.core.j.JavaAction$$anonfun$8.apply(JavaAction.scala:80) ~[play_2.10.jar:2.2.0]

但是,如果我不使用 spring(不使用 Global 且不使用 getControllerInstance),则示例工作得很好!请帮助我一起使用安全社交和 Spring。谢谢。

最佳答案

将此行添加到 Global.onStart() 中的 Global.java 中:

ctx.register(SecureSocial.Secured.class);

关于java - 为 play 框架和 spring 定制 secureSocial(依赖注入(inject)),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20451283/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com