我正在将Play 2.0.6的安全社交版本2.0.13用于Play 2.0.6。
我从类型安全的教程中下载了项目模板,并使用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),该示例就可以正常工作!
请帮助我一起使用安全社交和春季活动。
谢谢。

最佳答案

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

ctx.register(SecureSocial.Secured.class);

10-06 12:45