Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Spring Basics Introduction and Setting up Our Development Tools Gradle in Action

Binyamin Friedman
Binyamin Friedman
14,615 Points

Spark or Spring?

Previously in the Java Web Development track there was a course on Spark. When would you use one or the other?

1 Answer

Thomas Nilsen
Thomas Nilsen
14,957 Points

After a google search, the end of this article sums it up really well

What if I need more? Spark is a tiny web framework, which is both its main strength and its main weakness. It does what it claims to do really >well. Spark has an API which is consistent, simple, understandable, and flexible for handling requests, responses, filters >and so on. Spark is amazing for creating small web applications or API backends. It doesnโ€™t add much blackmagic into >your code, so you always know what you expect from the application without any surprises. At the same time itโ€™s >extendable and you can plug in any template engine of your liking.

However, if youโ€™re writing a more substantial web application you most probably will want to consider other aspects including the database, validation, web-services invocations, nosql databases etc. In that case, Iโ€™d prefer something that comes with the batteries included, such as the Playframework or Spring framework.

However, for a simple API endpoint Spark really managed to surprise me with how awesome it is. No wonder that the >2015 survey by Spark showed us that over 50% of Spark users use Spark to create REST APIs.