我正在使用带有 play 和 spring 的 Play 2.0.6 的安全社交版本 2.0.13。我从类型安全教程下载了项目模板,并使用来自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),示例就可以正常工作! 请帮助我一起使用安全社交和弹簧。谢谢。