standalone.xml 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <document><properties><title>Acegi Security Use Without Spring</title></properties><body><section name="Acegi Security Use Without Spring"><subsection name="Introduction"><p>Sometimes we get asked can Acegi Security be used without Spring.
  3. This page provides a detailed answer.</p></subsection><subsection name="History"><p>Acegi Security started out as a method interceptor for Spring IoC container
  4. managed beans. Typically such beans provide services layer functions.
  5. Over time Acegi Security grew to offer authentication services, <code>ThreadLocal</code> management,
  6. web request filtering, extra AOP support,
  7. ACL features, additional authentication mechanisms and so on (for those interested,
  8. see our <a href="changes-report.html">change log</a>).</p></subsection><subsection name="Why Use Spring"><p>There's plenty written about why the
  9. <a href="http://www.springframework.org">Spring Framework</a>
  10. is a good fit for modern applications. If you're not familiar with the benefits
  11. Spring offers, please take a few minutes to learn more about it. In numerous
  12. situations Spring will save you many months (or even years) of development time.
  13. Not to mention your solutions will be better architected
  14. (designed), better coded (implemented), and better supported (maintained) in the future.
  15. </p></subsection><subsection name="Acegi Security Dependencies on Spring"><p>Acegi Security relies on the Spring IoC container to wire its classes, and execute lifecycle
  16. methods such as <code>afterPropertiesSet()</code>. Some Acegi Security classes also
  17. publish events to the <code>ApplicationContext</code>, although you could provide a mock
  18. implementation of <code>ApplicationContext</code> easily enough which no-ops the method.
  19. In other words, if you particularly didn't want Spring in your application, you <i>could</i>
  20. avoid its use by writing equivalent getter, setter and lifecycle invocation processes
  21. in standard Java code. This is a natural consequence of the Spring way of development,
  22. which emphasises framework independence (it is <i>not</i> because we think there are good
  23. reasons people would <i>not</i> use Spring).</p><p>If it sounds too hard (it's not) or counter-productive (it is) to replace Spring's IoC
  24. services, don't forget you can always deploy Acegi Security and the Spring
  25. IoC container solely for configuring Acegi Security. Spring does not mandate its
  26. use in every part of your application. It will work quite successfully doing nothing more than
  27. acting as a configuration mechanism for Acegi Security. Whilst some may regard this as excessive,
  28. it's really no different than the traditional approach of every framework having its very
  29. own XML or other proprietary configuration system. The main difference is that Spring is an
  30. actual de facto standard, and you can gradually introduce it to other parts of your application
  31. over time (if desired).</p><p>Acegi Security does <i>not</i> use any other Spring capabilities. Most notably, the
  32. entire architecture is based around <code>Filter</code>s, not Spring's MVC framework.
  33. This allows it to be used with any MVC framework, or even with just straight JSPs.
  34. Acegi Security uses the AOP Alliance and AspectJ interfaces for method interception -
  35. it does not use any Spring-specific interfaces. As a consequence, Acegi Security is very
  36. portable to applications that do not leverage <i>any</i> of Spring's capabilities. We should note
  37. there are several very simple data access objects (DAOs) that use Spring's JDBC abstraction
  38. layer, although each of these are defined by a simple interface and it is very common in
  39. even native Spring-powered applications for these to be re-implemented using the application's
  40. persistence framework of choice (eg Hibernate).
  41. </p></subsection></section><section name="Conclusion"><p>In summary, we recommend you take a look at Spring and consider using it in your
  42. applications. Irrespective of whether you do so or not, we strongly recommend you use it
  43. for configuration and lifecycle management of Acegi Security. If that is also not desired,
  44. Acegi Security can easily be executed without Spring at all, providing you implement
  45. similar IoC services. Acegi Security has very minimal dependencies directly on Spring,
  46. with it being useful in many non-Spring applications and with non-Spring frameworks.
  47. </p></section></body></document>