Unless you're working alone or unless everybody knows exactly how the whole system works, being explicit will save you a lot of time.
If you're still insisting, I suggest you to clone random mid-size spring project from github and do some non-trivial change (like implement automatic tracking of all changes or soft-deletes)
You may be interested in programmatic / functional bean registration[0], which was introduced in Spring Framework 5. It has a particular focus on Kotlin support[1][2].
[0] https://springoneplatform.io/sessions/programmatic-bean-regi...
[1] https://spring.io/blog/2017/08/01/spring-framework-5-kotlin-...
This caught my eye. I have never used a Java framework, but use Rails daily. Does Spring Boot do Rails things such as migrations? Is there a healthy plugin ecosystems? (whatever the Gem equivalent in Java is).
After 3 years of building and maintaining a mission-critical Java backend, I would never do it again... We were using a similar framework, called dropwizard, great product, super lean and reliable.
If you think Rails is magic, then you haven't seen the Java world, all the magic with annotations, dependency injection, glueing libraries together by placing some files in a folder.
If you think Rails 2.3 to 3.0 upgrade was dramatic, then what we went through with a minor update from dropwizard (i think 0.7 to 0.8) was a nightmareish 1-2 months of rewriting half of the code and dependency injection handling.
Java is still super verbose, not just the language itself, but also all the libraries that are often over-engineered.
Hibernate is quiet easy to get started and you don't understand what all the fuss is about. But once you go start adding features it quickly becomes unmaintainable and any change to the models comes with FUD whether that'll make the queries explode in an unpredictable manner.
There's a lot of libraries, but on UI/UX level you don't have anything close to what Rails offers out of the box. Things you take for granted don't exist, like devise.
The good parts were: Rails deployments are from the stone-age compared to dropwizards simple approach of installing java and copying the self-running jar (fat binary) to server and start. Very good instrumentation/metrics out of the box with joda-metrics.
After 3 years, a pivot required us to rewrite large parts of the logic. We took that as a chance to rewrite/migrate all our services to Elixir/Phoenix. And never looked back.
So far Elixir/Phoenix/Ecto to me is the perfect middle ground between a solid Java environment and the speed of development of Rails.
> all the magic with annotations
... which are basically just decorators
> dependency injection
... which is quite useful for loose-coupling and injecting different implementations (and you don't have to use it)
> glueing libraries together by placing some files in a folder
.... what? Never done that ;-)
> Java is still super verbose, not just the language itself
I don't see that. It's actually quite nice for my taste. I guess you don't like generics, but then you have to live without them, which also sucks.
> There's a lot of libraries, but on UI/UX level you don't have anything close to what Rails offers out of the box.
What do you mean exactly? There are things like thymeleaf if you want SSR, otherwise you can put whatever SPA in front of it.
> things you take for granted don't exist, like devise.
.. it's not hard to use Spring Security though
>Elixir/Phoenix/Ecto" - is there some devise like auth by now? I also like Elixir/Phoenix quite a lot, but it's nowhere near Rails/Springs level.
Coherence https://github.com/smpallen99/coherence
Kinda curious why there was such a big migration conisdering dw is mostly just a combination of packages.
All the things you are complaining about have been abstracted away by many recent java and groovy libraries.
You are literally comparing some random company using a random java framework 4 years ago to modern ruby on rails. The comparison just doesn't work.
You can make java as simple as you want or as complex as you want. Modern tools like spring boot and groovy make it VERY easy to make java simple.
Most popular languages today have such a thing - cpan gor perl, pip for python, etc. In java there‘s at least maven for that with it’s huge library repositories.
There might be more nowadays, i‘ve not been using Java since a good while.
Regarding ecosystem, the Java one is the biggest and has much more to offer than any other technology. Spring Boot can work with all libraries and there exist Spring Boot plugins for the configuration of the most popular solutions (data storages, clouds, templates, MQs etc).
The package management in Java is mature and one of the best and is now replicated/reused on other platforms. E.g. Java-based Nexus repository can be used for hosting libraries for JS and Docker and tools like Apache Maven can build and manage not only Java projects (I think it's even possible to wrap Rails project in Maven).
Really? Does it do a lot of code generation across the db / server / front end?
That plus convention over configuration makes most of my rails development pretty fast.
BWAHAHAHAHAHA! Good one.
Seriously, though, I'm really, really glad to see this come up this morning.
I've done a lot of .NET lately, but Rails has been my main tool for 10 years. However, because it's (apparently) a strange, new, unproven-and-potentially-exceedingly-insecure framework, and because I'm the ONLY PERSON in a company of SIXTY THOUSAND employees who could possibly write a program with it, I've been forced to stop using it. I took FOUR MONTHS of arguing about it with the powers-that-be to conclude that I should use Java instead. I have 3 web applications to write, right now, with some flavor of Java EE.
For a couple of weeks, I've been trying to bootstrap an environment to read an existing database I had already created with Rails, and filled with production data. I thought it would have been straightforward. I'm trying to use current versions:
* Netbeans 8.2 * Java 1.8 * Gradle 4.6 * SpringMVC 5.0.4 * Hibernate 5.2.15
I can't find a single, working example that demonstrates this stack. Not a single one, on the entirety of the internet! Every example I can find switches out some part of that stack, and makes the flow different. Netbeans and Eclipse do things differently, and both have about 3 different ways to generate a Java web application.
Then there's the whole Maven thing. I guess most of the world hasn't really switched to Gradle, despite their site's glowing description of the advantages?
And what is "Spring Framework?" There's really several different pieces of that puzzle, and that's fine, but, at the end of the day, show me the code, AND TELL ME WHERE TO PUT IT IN THE FILE STRUCTURE TO MAKE IT WORK.
Most of the examples I can find about how to write a Java web application never even get to the point of pulling data from a database, and so finding an example that uses either Hibernate OR JPA is almost non-existent. This just makes me shake my head.
My current direction, which I was all set to get serious with today, was to use Groovy on Grails, under IntelliJ IDEA. After a couple of weeks of experimentation, it's the only stack I've been able to bootstrap, and actually get a listing of objects from the database. I feel it probably takes too many liberties to simplify the workflow, and will quickly lead to a bottleneck I don't know how to get out of, but, dammit, it's the only thing I can find some reasonable examples for.
(But even IDEA wants to generate a stack based on the non-current Spring 4.3.14, and Hibernate 5.1.5. Spring 5 is released. Why doesn't IDEA "support" it yet? What little examples I can find show that a lot of things are changing from Spring 4 to 5.)
Through this learning process, I've realized just how much tribal knowledge I've absorbed about Rails. I "grew up" with Rails. I was playing with it in the 0.x days, got serious with it in the early 2.x era, and have stayed with it ever since. I understood that learning how to use another web stack would be a challenge. While the actual language is hardly a concern to me, I had no idea that the chaos of choices and versions would complicate the process of just trying to get started. At the very least, when you say "Rails X.0", you've described all the major pieces of the stack, and the IDE is immaterial. That is simply not the case in the Java world.
So I've said all of this to set the context in order to ask you this: What is the "right" framework stack to use to create a Java web application TODAY? And by "right," I mean "most popular," in order to make finding answers as easy as possible. For the sake of argument, the 3 apps I need to write are essentially simple CRUD applications, so there are no esoteric requirements to consider. What's the most straightforward and maintainable approach, and where's the definitive documentation on how to configure it? I'm ready to go all-in on SOMETHING, but I'm overwhelmed with choices and a lack of examples.
The GP seemed to be indicating they were trying to put together a standard set of tools for others in their company to use. Having one official 'blessed' IDE and a 'standard' way to do things - even as a demonstration process - isn't out of the ordinary. And... given how much any complex Java program relies on the author having an IDE handle things for them (the assumption is that an IDE will help find the correct imports when developing, for example), it's pretty common for people to assume you're using one of the few common ones out there. I guess the author was looking for 'free' up front, but I'm curious why they didn't mention IntelliJ - it's the only thing I'd bother with for 'real' Java development in 2018 (although I'm keeping an eye on the vscode landscape).
> should read up on the documentation of the basics of java, gradle and spring first
There's no 'basics' to those - they are sprawling ecosystems, and any non-trivial task requires a pretty deep understanding of how those pieces fit together.
> maybe rails developers expect everything to be spoon fed to them in pieces of 5 minute screencasts or something?
Perhaps other tech stacks are able to deliver useful/functioning tutorials of information in 5 minute screencasts, without requiring someone to be an expert or have years of the 'tribal knowledge' the GP spoke of in another post?
Yup. This is forging a new trail at the company, which is, itself, a painful process.
I was a grails advocate for a long time. I put up with some of the initial pain (from 0.6 days) because it provided more benefit than not. And, had I not picked up intellij, I may have left the fold a long time ago. :)
As time has gone on, the coupling with Spring has become more obvious - I may have just been blissfully unaware earlier on. The migration to a 'spring boot' based approach has sort of soured me more than I expected. If I wanted to use Spring boot, I'd use it. I preferred some of the Grails conventions, but many have been thrown out or reduced to accommodate the Boot way. Some of the stuff I'd hoped to have to dig in to (and, in some cases, had not needed to be an expert in) have now become requirements to dig in to, and I spend more time configuring and digging through framework problems than the actual application.
No doubt much of this is me, but I'd hoped Grails would improve, but for me, it's just changed. My work with Java/Spring/etc definitely has helped me think about problems differently, and improved my thinking and coding overall, but much of what I was looking for has improved in other ecosystems over the last several years to make continuing in the Java world a harder decision. (context: I'm primarily a solo developer, not working with large teams or large budgets). One minor example: being able to make a code change in a test, run that one test, make another change, and rerun the test, all in a few seconds doesn't seem to be something that's possible in the Spring world, and perhaps not in the Java world in general (no doubt there will be people who tell me "you're doing it wrong" and "we run 4000 spring tests every 7 seconds with 0% CPU!" but it's not been my experience).
This was my experience when I began.
What I learned was: unit tests don't need Spring. It seems silly in retrospect, but that's the basic rule. If you need Spring in your unit tests, you probably made a mistake somewhere.
Having worked in a few languages and frameworks, having seen codebases at various levels of maturity and whatnot, I quite like Spring Boot & co. Especially when Kotlin is in the picture.
Really? You dismiss my clearly-not-ignorant comments by belittling me? OK. I should have known.
Part of the frustration here is this: given a clean sheet of paper, and a desire to write a Java-based web application, where do I start? What files do I download? I don't know! How do I start developing with Spring? The site says "add this line to your build file." WTF does that even mean, to a Java noob? What's the file I'm supposed to be putting that configuration into? Unless you have a file structure bootstrapped, and know that they're talking about pom.xml, in the case of Maven, or build.gradle, in the case of Gradle, it doesn't mean anything!
How did I figure that out? By using an IDE and generating example file structures for a "web application" based on those 2 options in the stack. So getting started with Spring requires an existing bootstrapped structure that I STILL don't know how to generate by hand. (Feel free to enlighten me. How do YOU start a new Spring project?) Hence, my frustration with the various IDE's, and their multiple ways of generating what should be a pretty standard stack of files to get started.
As I tried to indicate, I "get it" that I have a lot of this stuff internalized with respect to Rails, and that's what I'm trying to get across. I don't think that the Spring folks understand what they need to do to "onboard" someone to their system. At least Grails seems to do a better job with this.
When Spring started, there was already a myriad ways of doing stuff, and multiple IDEs, and multiple use cases for Java itself, and Spring was trying to answer a lot more up front.
If you're doing 'web' in Java (something I still think much of the java world still doesn't really 'get'), there are dozens of choices/options/etc. If, in 2006, you were planning to do 'web' and wanted to use Ruby... the primary choice was Rails. If you were doing 'web' and wanted to use Python... you similarly have often only had one or two major choices (I'd argue 'Zope' early on, then Django as a default go-to for the last 10 years or so). In the Java world... way too many choices up front, all answering similar problems, but slightly differently.
While Ruby was out before Rails, their popularity generally rose in tandem, and much of the tooling for the ecosystem seemed to develop in tandem during the progression of Rails itself.
Had Spring started in 1997, we might have seen a somewhat different trajectory re: choice/tooling/community/etc.
I'd suggest not to search for various "stacks". They might be written poorly and incomplete. Learn each part and learn how to combine them.
I guess Rails is a complete solution, with Java there are many libraries which you should choose and glue together. Every non-trivial application probably will use somewhat unique combination of libraries.
And how exactly did you search for examples, considering that there are pretty good guides and lots of examples right on the Github? Here's the one from Spring: https://spring.io/guides/gs/accessing-data-jpa/
That example is for JPA. I thought the "better" answer for a Java ORM was still Hibernate, and I can't find a Spring-based example for that. If you tell me that Hibernate has been usurped by JPA in Java developer mindshare, or if you tell me that JPA just works better with Spring, I can change course. I have no experience with either to make the call.
Here you can generate a project and you can select what options you want in your starter.
Of course the IDE is immaterial. I understand that developing in a stack that you are familiar with is much simpler for anyone but people could make similar claims in support of Java+Spring.
That being said, if you are forced into this by your company, I think that stepping back from this would help you a lot.
The IDE is absolutely irrelevant to java stack (of course, there are some little nuances when you do something like develop an eclipse plugin, but in your case where you list several general technologies, there should be zero dependency on an editor) - whether you use netbeans, eclipse, vim, vscode or intellij should change exactly nothing about your project setup, maybe except for extra .gitignore line or two for the editor specific files.
I suspect that majority of the problems you're describing stems from this misconception.
On another note: Just don't use Spring 5 or every other framework for a small simple thing which got just released.
There is no harm at all in using Spring 4 and all tools and everything is just working.
And, to be fair, I've also since discovered https://start.spring.io.
It's worth pointing out that both of these sites exist specifically to address my frustration in just getting started with a Java web stack, but it's taken me a couple of weeks to discover them.
Anyways, I would highly recommend using IntelliJ and Dropwizard, both of which “just work”. Don’t worry about anything else, just use the DW docs.
Is that version 2 or 3 of Grails? Virtually no-one has updated their Grails 2 websites to version 3, or is starting new projects in Grails 3. Choosing version 3 means first adopter risk.
I upgraded a couple v2 to v3, mostly because of concern about security (moderately sensitive data, most of the 2-era plugins aren't updated, etc). The allure of v3 was supposed to be "it's all spring boot!" but... I'm not capable enough of just installing random spring stuff and configuring it for boot - there's still 'stuff' grails does its own way (or... it's just my competency level?) But if I need to become much more proficient in spring boot to get benefit from grails 3... i'll just move to spring boot in the long haul. This seemed an inevitable move for grails, but not one I was excited about.
I understand that motivation, but given that someone else (company) has made some of this decision for you, based on - it seems - ability of other people in the company to take over the apps, is there not some internal standard or existing apps you can learn from?
I realize telling you how this is a stupid decision your company has made doesn't really help, but given the decision, I'd think that would mean there's someone else with existing Java web app knowledge/experience for you to learn from?
Having the app done in Java - even if it means it's 6 months late - seems to be more important than having the app(s) available now, which - that alone must be frustrating. :/
Frustrating doesn't even scratch the surface of what this is. And, to be fair, my attitude about how this has gone hasn't exactly helped me find the answers I need. ;-)
Correct me if I'm wrong: for several WEEKS you're struggling with implementing a database read?