TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Java Micro Frameworks

123 点作者 tkfx将近 10 年前

20 条评论

pvg将近 10 年前
This is an odd and uninformative write-up that compares two things (Jodd, Ninja) that aren&#x27;t really micro-frameworks (say, in the mold of Flask or Sinatra) with one that is (Spark). The comparison seems based purely on advertised features and, even stranger, number of github stars and forks.<p>Spark is a Sinatra-inspired micro-framework built on the familiar &#x27;call me when this HTTP verb happens&#x27; pattern. It does little beyond that but is quick and easy to get up and running.<p>Despite the forks and stars, it&#x27;s also probably the least mature of the three - it&#x27;s not hard to run into a bug or a wart. Those are usually easy to find and fix since it&#x27;s pretty small. On the other hand, the maintainer has been busy with other things for quite some time and it takes a very long time for PRs to get much attention. The testing setup is an ugly mess so adding a test for your fix is also unpleasant.<p>A couple of other constraints are that it requires Java 8 and, while it theoretically supports running in an arbitrary servlet container, it&#x27;s really happiest living in embedded Jetty.
danneu将近 10 年前
From Spark&#x27;s homepage copy:<p><pre><code> Why use Spark? If you&#x27;re a Java developer with neither the urge nor time to learn a new programming language, and you&#x27;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. </code></pre> Maybe they&#x27;re just being honest, but &quot;use Spark if you&#x27;re stuck with Java and can&#x27;t be bothered to learn something else&quot; is a bit off-putting.<p>I think a better angle looks something like &quot;use Spark if you want a simple, minimal Java microframework&quot; and &quot;if you&#x27;re coming from Sinatra&#x2F;Flask&#x2F;Express and you want something more statically-typed&quot;.
评论 #9694359 未加载
评论 #9694508 未加载
评论 #9694808 未加载
lmm将近 10 年前
It&#x27;s long been ironic that Java has excellent dependency management in the form of Maven - better than any other tool I&#x27;ve used, for any language - but the typical java project had far fewer dependencies than in ruby or node. Glad to see some smaller libraries emerging (and it&#x27;s worth noting that even e.g. spring is now released as a collection of smaller modules rather than one giant jar).
评论 #9693074 未加载
评论 #9692984 未加载
评论 #9693938 未加载
评论 #9693816 未加载
评论 #9693114 未加载
评论 #9693939 未加载
zaphar将近 10 年前
The author starts out by saying that one consequence of Java<p><pre><code> being a safe, rigorously tested, backwards compatible language is making some sacrifices around agility and streamlining. </code></pre> Yet there is nothing in Java as a language that prevents agility and streamlining. It&#x27;s not a consequence of Java the language it is purely a consequence of Java&#x27;s community.<p>It&#x27;s true that there are a lot of people who when doing java are starting to change the community from the inside and this is good. But pretending like you are fighting the language when doing this is counterproductive.
评论 #9693585 未加载
javajosh将近 10 年前
Uh, what about Dropwizard[1]? By Github stars, it&#x27;s 50% bigger than Spark, the most popular in this writeup.<p>It&#x27;s really quite good. Provides integrated, configured libraries for REST, JSON, health checks and metrics. Even supports shaded fat jars (which provide a true single &quot;java binary&quot; you can execute with java -jar). It&#x27;s really quite nice.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;dropwizard&#x2F;dropwizard" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dropwizard&#x2F;dropwizard</a>
评论 #9692997 未加载
评论 #9692981 未加载
scarmig将近 10 年前
Is it too grumpy for me to complain about Spark&#x27;s name? It postdates the more well-known one by like a year or two.
评论 #9693732 未加载
评论 #9694519 未加载
stickfigure将近 10 年前
For folks working with Guice that want a <i>really</i> simple and stripped down framework, check out GWizard:<p><a href="http:&#x2F;&#x2F;www.gwizard.org" rel="nofollow">http:&#x2F;&#x2F;www.gwizard.org</a><p>It&#x27;s basically DropWizard reimagined with dependency injection. Thanks to Guice, there&#x27;s surprisingly little code involved.<p>(I&#x27;m the primary developer)
评论 #9693640 未加载
erikb将近 10 年前
Can someone reframe the definition of the term &quot;micro framework&quot;? I understand the article as micro=very small, but the first example has a lot of batteries included. Isn&#x27;t that the opposite?
评论 #9694125 未加载
评论 #9693770 未加载
nogridbag将近 10 年前
I&#x27;ve toyed with both Ninja and Spark a bit in the past and have nothing but positive things to say about them. I mainly use Spark these days when I want a quick web app server to experiment with the JS framework of the day. Spark is great if you want complete control over your stack. So for example I paired it with Dagger for DI and plain JDBC for persistence. But of course it took some amount of effort to create this initial plumbing whereas with something like Ninja (and most other web frameworks), all this is already done for you.
评论 #9693679 未加载
timclark将近 10 年前
Ratpack - <a href="http:&#x2F;&#x2F;ratpack.io" rel="nofollow">http:&#x2F;&#x2F;ratpack.io</a> is another interesting Java micro framework.
aikah将近 10 年前
meh, in most businesses you&#x27;ll still have to maintain these huge struts&#x2F;spring apps. You can&#x27;t call yourself a java web dev and not know all the Spring ecosystem, so if the goal is to make things easier, well for whom? not for new comers who&#x27;ll still have to learn a bunch of legacy XML backed frameworks and all the JEE stack.
CSDude将近 10 年前
In the place I work we can deploy an enterprise Spring web application in 15 seconds, in my local machine. I truly miss those microframeworks, where a deploy is nothing but a restart of the process. I know Spring does so much under the hood, but those benefits do not make up for those ridicilous startup times and deploy scenarios.
评论 #9693848 未加载
评论 #9693080 未加载
评论 #9693670 未加载
评论 #9693197 未加载
dikaiosune将近 10 年前
I&#x27;ve looked at ninja a couple of times, and I&#x27;ve always been turned off by what appears to be a lack of Gradle support and the need for a special compilation tool chain. Whenever possible I like to keep tooling as vanilla and commodity as possible.<p>EDIT: Oops! See my reply below.
评论 #9693669 未加载
facepalm将近 10 年前
Very sparse on details, unfortunately. What makes those frameworks so micro?
treenyc将近 10 年前
&gt; Java micro frameworks are an attempt to address the weaknesses of Java while maintaining its strengths<p>What about all those scripting language for java?<p>Jruby, Jython, Rhino, Nashorn....
sgt将近 10 年前
Interesting - but people should note there&#x27;s also something to be said about the more light-weight components of Java EE 6.<p>For instance CDI for injection and inversion of control, plain JDBC, JAX-RS for RESTful API&#x27;s on Tomcat or Wildfly app server. Not always necessary to use the more heavy weight technologies such as EJB, JMS, JPA (particularly the last one should be avoided, in my opinion).<p>Admittedly the concept of an app server can seem antiquated to some, but it&#x27;s not necessarily a negative thing either.<p>They do bring useful things to the table, and can be used to build powerful and scalable apps - microservices as well even if they run within a container.
davelnewton将近 10 年前
You beat me by a couple of minutes :)<p>I&#x27;m no Java lover, but for some purposes (some non-technical) it&#x27;s the only real option. These seem like great ways to cut the bloat and still get stuff done.
评论 #9693523 未加载
travjones将近 10 年前
It&#x27;s funny that the author is selling the concept of microframeworks as a &quot;new trend.&quot; It seems that devs are moving away from monolithic frameworks in general (no matter the language) for practical reasons, not because it&#x27;s a &quot;trend.&quot;
评论 #9693749 未加载
评论 #9694424 未加载
avodonosov将近 10 年前
I ignore it with ease :)
评论 #9693520 未加载
ExpiredLink将近 10 年前
Well, you must first commit yourself to Micro-Services before you can consider Micro-Frameworks. The Micro-Services hype currently seems disappear as fast as it appeared.
评论 #9693273 未加载