Announcement Announcement Module
No announcement yet.
Accessing spring beans from outside Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing spring beans from outside

    Hi everybody,

    If I code some beans witch are POJOs (not EJBs) with spring, can I access them from:
    - an other application in the same container?
    - an other application in a remote server?

    Thanks for yours answers.

  • #2
    In the same container, but different application I don't think you'd be able to because I believe each application has its own classloader. I guess it might depend on the application server.

    Unless you export your POJO using some remoting strategy (of which there are several) you can't access the object remotely. Take a look at the Spring reference manual for more details.


    • #3

      if the beans are singletons then its a non issue as log as you can get to them... via some other means like RMI or JAXRPC, etc.... (because it will be the same object)

      if they are prototype beans then from within another webapp in the same container shoudl be possible...
      by using a common classpath (system classpath)
      and J2EE 1.4 also allows for Session sharing between webapps, which might also be of some benefit to you, depending on your exact needs.



      • #4
        easiest method?

        What is the easiest method (to implement and access from outside)?

        RMI? Hessian/Burlap? Spring's own HTTP invoker? Web services?


        • #5
          and what about jmx

          in a java world : add jmx in your list (rmi extention) : i think it's spring gurus
          secret blow of heart
          (you can expose a business layer with rmi exposer with 10 lines and some good interfaces in spring config : that's rock ! usefull for an admin service)

          info from the root :

          see jmx :
          # expose any spring bean to JMX
          # dependency inject to JMX proxies

          for other interop caller: hmmm the ugly webservice soup (be careful of what type of soap you choose !? )
          with axis or xfire

          ps : for 24/7 application ... or to help the turtle to become a rabbit help me to integrate apache mina (a generic protocol layer builder) to spring
          see "spring nio" in spring modules ( any suggestions are welcome ...)

          Last edited by icube; Mar 10th, 2006, 08:11 AM.