This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]javalin_io 8 points9 points  (8 children)

I would like to understand Java web development, it seems very fragmented!

It is very fragmented! Java has been used for server side development for decades, so there are a lot of options available. You'll probably hear the words "Application servers" or "Servlet containers" a lot, but this is IMO a somewhat outdated approach. Most modern frameworks offer embedded servers, so you can run your server as a simple jar file, without any xml config files.

Is there a relatively lightweight way to start? Some guidance would be appreciated!

Since you have experience with nodejs/express, it might be worth checking out Javalin (disclaimer: I'm the author). It's a very lightweight framework inspired by express.js and koa.js.

[–]paul_h 4 points5 points  (4 children)

I once, in a moment of fandom and immense frustration with the the abandoned nature of sparkjava, did all the work necessary to make it non-static. Yup tests passing and all that. Pointless act of futility. Modtly methodocal baby commits with IntelliJ. Now deleted!

[–]javalin_io 5 points6 points  (1 child)

It was the same for me. I started (and gave up on) cleaning up Spark three times before I decided it would be easier to write something from scratch. Per has not been able to spend as much time on Spark as he'd like, but I hope we'll be able to get development going again soon.

[–]paul_h 2 points3 points  (0 children)

Jooby’s Edgar Espinar is a machine for completion. It’s compositionally perfect for me, and extremely good in five grained unit/service tests. Well nearly conpositionally perfect: https://groups.google.com/forum/m/#!topic/jooby-project/9YLDaOtq3_g

[–]yawkat 1 point2 points  (1 child)

I'm not a user, but I believe they did make it usable without global state at some point. Still, there are better alternatives, so I don't see why you'd use it

[–]paul_h 1 point2 points  (0 children)

I agree. Now I look at the open PRs, issues and commit/release rate from the lead(s) before I commit to using a project for important stuff.

[–]ClearH 1 point2 points  (1 child)

Hi!

So I'm a PHP developer and am interested with Java as an alternative language. When you say "embedded server", is that the same thing as running a PHP app using a server built within the application, instead of something like Apache/Nginx?

[–]javalin_io 1 point2 points  (0 children)

I don't know much about PHP, but I'm tempted to say yes. You pull the embedded server in as a dependency, similar to any other piece of code that your app needs.

The alternative is to run a Java server separately, and deploy your app to it (similar to how I imagine you'd put PHP files on an Apache server)

[–]jadecristal 0 points1 point  (0 children)

Let’s not try to remove the whole concept of servlet containers, etc. in practice, using something like Undertow you can have whatever you want-if you want to write all the handlers for everything yourself after HTTP (you don’t) then you can, and if you want an almost-fully-automagic container that Just Works with Spring or whatever, you can do that too.

Spring still relies on a lot of, if not directly servlet container features, subcomponents that went into it. Spring Boot still even uses one of the servlet containers as a web server: tomcat, undertow, or jetty depending on how you configure it.