Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.