[2.2.1-java] Play 2.2.1, Spring Context, @With annotation not working

277 views
Skip to first unread message

Haris Osmanagic

unread,
Dec 27, 2013, 5:29:15 AM12/27/13
to play-fr...@googlegroups.com
Hi Players,

I've got the following situation (below you can see a link to the code): 

I have a Play 2.2.1 project, with Spring, made by using an example here: https://github.com/guillaumebort/play20-spring-demo The example is modified so that it uses Play 2.2.1 and Spring 4.0.0

Than I tried composing actions, using instructions provided here: http://www.playframework.com/documentation/2.2.x/JavaActionsComposition And it doesn't work. When I call an action annotated with @With, I get the following exception:

Internal server error, for (GET) [/] ->

play.api.Application$$anon$1: Execution exception[[NoSuchBeanDefinitionException: No qualifying bean of type [models.VerboseAction] is defined]]
at play.api.Application$class.handleError(Application.scala:293) ~[play_2.10.jar:2.2.1]
at play.api.DefaultApplication.handleError(Application.scala:399) [play_2.10.jar:2.2.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]
at scala.Option.map(Option.scala:145) [scala-library.jar:na]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$2.applyOrElse(PlayDefaultUpstreamHandler.scala:261) [play_2.10.jar:2.2.1]
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [models.VerboseAction] is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:318) ~[spring-beans-4.0.0.RELEASE.jar:4.0.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:985) ~[spring-context-4.0.0.RELEASE.jar:4.0.0.RELEASE]
at Global.getControllerInstance(Global.java:17) ~[classes/:na]
at play.core.j.JavaGlobalSettingsAdapter.getControllerInstance(JavaGlobalSettingsAdapter.scala:46) ~[play_2.10.jar:2.2.1]
at play.core.j.JavaAction$$anonfun$8.apply(JavaAction.scala:80) ~[play_2.10.jar:2.2.1]
at play.core.j.JavaAction$$anonfun$8.apply(JavaAction.scala:77) ~[play_2.10.jar:2.2.1]


What I found out until now is that this is not the case with all annotations. I created a dummy annotation, @Foo, used it to annotate my action, and it works.

Is there something I'm doing wrong, or is this a bug? You can find some code demoing this problem here: https://github.com/hariso/play2-2-1-spring-demo/tree/bug

Thanks a lot for any help,

Haris

Haris Osmanagic

unread,
Jan 8, 2014, 9:13:23 AM1/8/14
to play-fr...@googlegroups.com
Still no clue?

alex s

unread,
Jan 8, 2014, 7:04:32 PM1/8/14
to play-fr...@googlegroups.com
среда, 8 января 2014 г., 18:13:23 UTC+4 пользователь Haris Osmanagic написал:
    Still no clue?


> Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [models.VerboseAction] is defined
> at Global.getControllerInstance(Global.java:17) ~[classes/:na]

1. Move VerboseAction to controllers package.
2. Annotate it with org.springframework.stereotype.Controller.

Haris Osmanagic

unread,
Jan 9, 2014, 5:56:19 AM1/9/14
to play-fr...@googlegroups.com
That worked, thanks!
Reply all
Reply to author
Forward
0 new messages