Spark - A tiny Sinatra inspired framework for creating web applications in Java 8 with minimal effor


Spark - A tiny Sinatra inspired framework for creating web applications in Java 8 with minimal effort

Quick start

import static spark.Spark.*;

public class HelloWorld {
    public static void main(String[] args) {
        get("/hello", (req, res) -> "Hello World");
    }
}

Run and view

http://localhost:4567/hello

Built for productivity

Spark is a simple and lightweight Java web framework built for rapid development. Spark's intention isn't to compete with Sinatra, or the dozen of similar web frameworks in different languages, but to provide a pure Java alternative for developers that want to, or are required to, develop in Java.

Spark focuses on being as simple and straight-forward as possible, without the need for cumbersome (XML) configuration, to enable very fast web application development in pure Java with minimal effort. It’s a totally different paradigm when compared to the overuse of annotations for accomplishing pretty trivial stuff seen in other web frameworks, for example, JAX-RS implementations.

Why use Spark?

If you're a Java developer with neither the urge nor time to learn a new programming language, and you're not planning to build a super large web application that scales in all directions, then Spark might be a great web framework for you. It will have you up and running in minutes, and you won't have to think too much about configuration and boilerplate code (like you often have to in other Java web frameworks, like Spring or Vaadin).

Why not use Sinatra?

If you're an experienced Ruby developer, or have experience with languages with similar syntax, you should definitely use Sinatra. However, if you're a Java developer and want to get the benefits you get from Sinatra without having to learn a new language, Spark is a really good alternative. Spark is a simple and lightweight Java web framework that doesn't get in your way!

Why not go with JAX-RS?

JAX-RS made life easier for Java web developers when it arrived. However, it's a bit messy due to the overuse of annotations for accomplishing pretty trivial things. The annotation magic also makes things more implicit, and it's not always easy to get a clear understanding of what's going on. For people who are new to web frameworks and REST, Spark will have you up and running much faster than using one of the JAX-RS implementations.

Spark is created and maintained by Per Wendel. Logo and website by David Åse

时间: 2024-11-04 00:21:38

Spark - A tiny Sinatra inspired framework for creating web applications in Java 8 with minimal effor的相关文章

解析android framework下利用app_process来调用java写的命令及示例

解析android framework下利用app_process来调用java写的命令及示例          在android SDK的framework/base/cmds目录下了,有不少目录,这些目的最终都是build出一个bin文件,再存放到/system/bin目录下,对于C/CPP写的命令,我们还是比较好理解的,都有一个main函数作为入口,但是在cmds目录下还有一些原生代码是java的,比如input.settings,那么这种类型的命令是怎么实现的呢?       笔者研习了

Thoughtworks Techniques

If you are wondering "What comes after agile?," you should look towards continuous delivery. While your development processes may be fully optimized, it still might take your organization weeks or months to get a single change into production. C

GO语言的开源库

Indexes and search engines These sites provide indexes and search engines for Go packages: godoc.org gowalker gosearch Sourcegraph Contributing To edit this page you must be a contributor to the go-wiki project. To get contributor access, send mail t

Javascript开发包汇总

javascript Javascript开发包汇总 Permalink Javascript libraries roundup   Prototype Prototype is a JavaScript framework that aims to ease development of dynamic web applications. Homepage: http://prototype.conio.net Documentation:http://blogs.ebusiness-app

TinyDBF-用200行的DBF解析器来展示良好架构设计

序言 由于工作关系,需要工作当中,需要读取DBF文件,找了一些DBF读取开源软件,要么是太过庞大,动不动就上万行,要么是功能有问题,编码,长度,总之是没有找到一个非常爽的.在万般无奈之下,我老人家怒从心头起,恶向胆边生,决定自己写一下.结果只用了不到300行代码就搞定了,当然搞定不是唯一目标,还要优雅简洁的搞定,亲们跟随我的脚步一起感受一下简洁的设计与实现吧. 在开始编码之前,先介绍一下DBF,这个DBF可是个老东西,在DOS时代就已经出现,并且风骚了相当一段时间,后来随着大型数据库的应用,它逐

【OH】Glossary Oracle词汇表(上)

Glossary [OH]Glossary Oracle词汇表(上) Oracle? Multimedia DICOM Developer's Guide 11g Release 2 (11.2) E10778-03 Glossary ● anonymity document An XML document that specifies the set of attributes to be made anonymous, and defines the actions required to

2015 最简单的 Spring MVC 入门教程

2015 最简单的 Spring MVC 入门教程 太阳火神的美丽人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致"创作公用协议 转载请保留此句:太阳火神的美丽人生 -  本博客专注于 敏捷开发及移动和物联设备研究:iOS.Android.Html5.Arduino.pcDuino,否则,出自本博客的文章拒绝转载或再转载,谢谢合作. Simplest Spring MVC Hello World Example / Tutor

dotCloud say PostgreSQL does not scale for High Availability on the dotCloud Platform

dotCloud是cloudControl提供的一个商业PaaS产品.  About the dotCloud Platform The dotCloud Platform is a service provided by cloudControl, Inc. The Platform launched in 2011 as the industry's first multi-language Platform as a Service. The Platform simplifies app

NodeJS 各websocket框架性能分析

For a current project at WhoScored, I needed to learn JavaScript, Node.js and WebSocket channel, after seven years of writing web applications with Java and Spring framework. We wanted an application that can send data to thousands of concurrent user