1

Can I use Struts2 without Spring IoC?

5 Answers 5

4

Spring is only one option. You can work with others like Google Guice or without IOC.

0
2

Yes you can, even when you can integrate both on your project, it is not required.

2

Struts2 was designed with dependency injection in mind and adheres to the principles pretty well (the underlying XWork framework uses an early version of Guice). You can step up to Guice or Spring later using the appropriate plug-in.

1

Yes

Spring IOC is just a pluggable object dependency container, which manages objects for you. It is optional.

4
  • 1
    +1. Thanks, But I find quote in Starting Struts2 '...And finally, dependency injection is now a first class citizen – provided via the Spring Framework...' by Ian Roughley, How I should understand it? Jan 24, 2011 at 15:57
  • 1
    mostly with good designed project Spring[IOC] is used at service layer with struts. you can follow tutorial here & here
    – jmj
    Jan 24, 2011 at 16:06
  • IoC is a good thing, it is generally best to start with the struts2 documentation (using the struts2-spring-plugin) struts.apache.org/2.0.8/docs/spring-plugin.html
    – Quaternion
    Jan 24, 2011 at 16:28
  • 1
    @Quat Yes, Spring IOC is very good thing, but as beginner I would recommend OP to quick start plain struts and then he will automatically switch with Spring :)
    – jmj
    Jan 24, 2011 at 16:35
-1

Basically both are independent. You can definitely use Struts 2 without Spring IOC.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.