Announcement Announcement Module
Collapse
No announcement yet.
Spring Social Maven Project using Springs Annotations for Security. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Social Maven Project using Springs Annotations for Security.

    Hi Everyone,

    Could someone please provide me with a Spring Annotations driven WEb MVC example?

    I prefer not to use the @Inject i:e the java based configurations. It would be cool to have all the beans mapped in the xmls and then autowired in the controllers or other DAO classes. Makes it more readable. Also, including the Spring Security module included.

    Thanks in Advance!!!

  • #2
    I'm a bit unclear on what you're asking for and want to understand it better before offering an answer. You say "Spring Annotations driven", but then say you don't want to "use @Inject i:e the java based configurations." Then you say you want the beans mapped in xmls. So what parts (if any) would you want to see configured in XML and what parts (if any) would you want configured in Java?

    Comment


    • #3
      Hi Habuma/Craig,

      Extremely sorry for not conveying the information properly.

      Actually in the Spring Social Sample project, I see that all the beans configuration related the Spring Social API is mapped using Java Based Configuration, It is easy to understand the project if you do that, however, in your actual project, you would really want it to be mapped using xml configurations, where you declare your beans in xml files and then wherever you need it, you can use the @Autowired annotation, to use them.

      Please let me if I am still not clear..

      Thanks!

      Comment


      • #4
        Well, there are samples in that project that use XML configuration (see the twitter4j example and the spring-social-showcase-xml example; although the latter example uses some new stuff to be in Spring Social 1.1.0.M1).

        The truth is that without the new stuff I've been working on for 1.1.0.M1, XML-based configuration isn't quite as simple as the Java configuration. For the most part it's simple, but the part where you determine who the current user is for the purposes of creating a connection repository is not easy in XML and often requires at least some Java config. Also the part where the API bindings are created is tricky in XML because a decision is made to create an API binding from the current connection if there is one or as a default implementation if there is not a connection.

        So, yes there are examples that show the XML config. But it's a bit more complex. And, if you really want XML config it's not that hard to convert an existing Java config file to XML (those tricky parts notwithstanding).

        Again, as I move toward a 1.1.0.M1 release and even a 1.1.0 final release, I anticipate that there will be more examples created. When that happens, I'll keep in mind your request for more XML-based configuration. And, with the new XML namespaces in 1.1.0, that'll be even easier than ever before.

        Comment


        • #5
          New XML namespaces would rock!!! That would do I guess...will surely wait for that...
          Thanks for Replying Craig...and thanks implementing the spring-social, you have done a great job!!!!
          Thank you!!

          Comment


          • #6
            Have a look at what I've done at https://github.com/SpringSource/spri...fig/social.xml and let me know what you think. This work is still subject to change, but at this point it works and is quite succinct compared to how it might look without the namespaces. I'd love to hear feedback on this stuff.

            Comment


            • #7
              This looks great!!!!!!!!!!!!!!Its more similar with other spring api's, for eg its likes Spring Security.

              However, I did not understand this...<social:jdbc-connection-repository/>

              I think it should be something like this

              <social:jdbc-connection-repository>
              <property value="datasource" ref="myDataSource">
              <social:jdbc-connection-repository/>

              Thanks for working more on this...looking forward!!!!

              ~Sumit

              Comment


              • #8
                There is a data-source-ref attribute on <social:jdbc-connection-repository>, but per the XSD, it defaults to "dataSource". If you wanted to set it to "myDataSource", you could do it like this:

                Code:
                <social:jdbc-connection-repository data-source-ref="myDataSource" />
                See the XSD at https://github.com/SpringSource/spri...social-1.1.xsd to see what else you can configure on it and what the defaults are.

                Comment


                • #9
                  This is perfect!! that solves one of my doubt that I had....

                  I may be asking for too much...but most of the xsd is not commented...I mean it would be really helpful for others to understand the framework...may be you would be planning to add the comments when its complete...so thats fine.

                  Also, as Spring Security or Spring MVC follow the patterns of having an xml file, which makes it easy to configure.
                  For eg:In Spring security all that we need to do is, drop the xml file which contains all the security beans, which we could get easily from somewhere or from old code...add a filter mapping in web.xml and we are ready to go...

                  I know this is a little bit tricky here(Spring Social) but most of developers would prefer it that way..because then all we need to worry about it, just to get the data from the Provider and then do what magical stuff they want too...
                  thats just suggestion...

                  However, I am very proud of this API!!! keep it up Craig!! looking forward!!

                  Comment

                  Working...
                  X