play and spring

102 views
Skip to first unread message

amaziane nafia

unread,
Nov 15, 2013, 6:50:53 PM11/15/13
to play-fr...@googlegroups.com
Hello everybody.

Can we use play with spring ? if yes ,can you give me some examples ?

Nafia

Will Sargent

unread,
Nov 15, 2013, 7:33:48 PM11/15/13
to play-fr...@googlegroups.com
You can use Play with several DI frameworks.  The examples are listed in the documentation:

http://www.playframework.com/documentation/2.2.x/ScalaDependencyInjection

Will Sargent
Consultant, Professional Services
Typesafe, the company behind Play Framework, Akka and Scala


--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

amaziane nafia

unread,
Nov 15, 2013, 9:15:01 PM11/15/13
to play-fr...@googlegroups.com
thinks you for your answer i think that i don't have specified correctly my question , in fact .
first Play/Java with spring ? if yes how to install it, because i started to work with play without spring and when i put in command line :play install spring , it give me just a oldest version spring (1.x) . i'd like to work with spring 3.x to inject beans with annotations.

Nafia
Beginner play developer.


2013/11/16 Will Sargent <will.s...@typesafe.com>

--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/z2qY5mJdg3U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framewor...@googlegroups.com.

Ben McCann

unread,
Nov 16, 2013, 12:47:56 AM11/16/13
to play-fr...@googlegroups.com
Yes, you can do it in Java. I filed a bug asking for more documentation on this. I use Guice, so I'm not an expert with Spring, but here's what I do:

public class Global extends GlobalSettings {

  private static Injector injector;

  @Override
  public void onStart(Application application) {
    injector = Guice.createInjector(new MyAppModule());
  }
  
  @Override
  public <A> A getControllerInstance(Class<A> controllerClass) throws Exception {
    return injector.getInstance(controllerClass);
  }
  
}

You can include any jar that's in the Maven central repository in your project like spring. For example:
"org.springframework" % "spring-core" % "3.2.5.RELEASE"

-Ben

James Ward

unread,
Nov 16, 2013, 3:40:11 AM11/16/13
to play-fr...@googlegroups.com
I'd recommend starting with the Play + Java + Spring template in Activator:
http://typesafe.com/activator/template/play-java-spring

-James


On 11/15/2013 07:15 PM, amaziane nafia wrote:
> thinks you for your answer i think that i don't have specified correctly
> my question , in fact .
> first Play/Java with spring ? if yes how to install it, because i
> started to work with play without spring and when i put in command line
> :play install spring , it give me just a oldest version spring (1.x) .
> i'd like to work with spring 3.x to inject beans with annotations.
>
> Nafia
> Beginner play developer.
>
>
> 2013/11/16 Will Sargent <will.s...@typesafe.com
> <mailto:will.s...@typesafe.com>>
>
> You can use Play with several DI frameworks. The examples are
> listed in the documentation:
>
> http://www.playframework.com/documentation/2.2.x/ScalaDependencyInjection
>
> Will Sargent
> Consultant, Professional Services
> Typesafe <http://typesafe.com>, the company behind Play Framework
> <http://www.playframework.com>, Akka <http://akka.io> and Scala
> <http://www.scala-lang.org/>
>
>
> On Fri, Nov 15, 2013 at 3:50 PM, amaziane nafia
> <amazi...@gmail.com <mailto:amazi...@gmail.com>> wrote:
>
> Hello everybody.
>
> Can we use play with spring ? if yes ,can you give me some
> examples ?
>
> Nafia
>
> --
> You received this message because you are subscribed to the
> Google Groups "play-framework" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to play-framewor...@googlegroups.com
> <mailto:play-framework%2Bunsu...@googlegroups.com>.
>
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> You received this message because you are subscribed to a topic in
> the Google Groups "play-framework" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/play-framework/z2qY5mJdg3U/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> play-framewor...@googlegroups.com
> <mailto:play-framework%2Bunsu...@googlegroups.com>.

amaziane nafia

unread,
Nov 16, 2013, 1:53:33 PM11/16/13
to play-fr...@googlegroups.com
Thinks everybody , i will flow all of these docs , and i will return to you for result .

Nafia


2013/11/16 James Ward <james...@typesafe.com>
I'd recommend starting with the Play + Java + Spring template in Activator:
http://typesafe.com/activator/template/play-java-spring

-James



On 11/15/2013 07:15 PM, amaziane nafia wrote:
thinks you for your answer i think that i don't have specified correctly
my question , in fact .
first Play/Java with spring ? if yes how to install it, because i
started to work with play without spring and when i put in command line
:play install spring , it give me just a oldest version spring (1.x) .
i'd like to work with spring 3.x to inject beans with annotations.

Nafia
Beginner play developer.


2013/11/16 Will Sargent <will.s...@typesafe.com


    You can use Play with several DI frameworks.  The examples are
    listed in the documentation:

    http://www.playframework.com/documentation/2.2.x/ScalaDependencyInjection

    Will Sargent
    Consultant, Professional Services
    Typesafe <http://typesafe.com>, the company behind Play Framework
    <http://www.playframework.com>, Akka <http://akka.io> and Scala
    <http://www.scala-lang.org/>



    On Fri, Nov 15, 2013 at 3:50 PM, amaziane nafia
    <amazi...@gmail.com <mailto:amazi...@gmail.com>> wrote:

        Hello everybody.

        Can we use play with spring ? if yes ,can you give me some
        examples ?

        Nafia

        --
        You received this message because you are subscribed to the
        Google Groups "play-framework" group.
        To unsubscribe from this group and stop receiving emails from
        it, send an email to play-framework+unsubscribe@googlegroups.com
        <mailto:play-framework%2Bunsu...@googlegroups.com>.


        For more options, visit https://groups.google.com/groups/opt_out.


    --
    You received this message because you are subscribed to a topic in
    the Google Groups "play-framework" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/play-framework/z2qY5mJdg3U/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to

    For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google
Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the Google Groups "play-framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/play-framework/z2qY5mJdg3U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to play-framework+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages