• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Spring Boot In Action: plugin system?

Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Craig,

I have a question about the Spring ecosystem, particularly now that Spring Boot is out. Have you ever heard about the Symfony2 framework? It's an MVC framework done in PHP, working very similarly to Spring because it is based on IoC. A few of my friends use it and are incredibly productive, because of the bundle system. The framework is built in such a way that you are able to create easily reusable code, even for entities, repositories and controllers. And it is super easy to customize such code by extending classes or changing yml config files. So what happened is that a major part of the PHP community started publishing bundles on github, and there is a bundle for virtually ANYTHING, from CMS to user management to paypal payments, order tracking etc.

A great example is the FOSUserBundle: it gives you right out of the box a User entity, already mapped to the database, it gives you controllers and services for anything which has to do with users: password reset, activation link, enabling/disabling, soft delete. It is highly configurable, for example you can choose to use the email address as username. It even gives you simple raw HTML templates with all necessary forms for editing and listing users. And most importantly, it is easily extensible: you can simply extend their User entity and do your own, and even extend their controllers/services to change any behaviour, or choose different url mappings.

All my friends had to do was to put some new fields in the entity, remake the templates with Bootstrap and in a matter of a few hours they had something it takes me 2 days to do in Spring. And it's like this for anything they have to do: they just use existing code from the community and extend it. They even built their own bundle to manage CRUD operations with simple Bootstrap templates. Would you believe me if I told you they built an application with 120 entities in less than 3 months of 2 people working part time? And I'm pretty sure people working on Ruby on Rails have the same kind of productivity.

I know that this isn't happening in the Spring ecosystem because of the many different ways there are to do things: many different templating engines, many different options for persistence, and so on. But wouldn't it be interesting if Spring Boot implemented a standardized way of writing reusable plugins? Just like other Spring-based frameworks like Grails already do. Maybe it needs to be slightly opinionated on how to do it, but isn't that the exact reason why Spring Boot is here?
Posts: 422
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Firstly, I've never heard of Symfony 2, but that's likely because I very rarely venture into PHP space.

That said, Spring Boot *is* opinionated when it comes to how to configure Spring, but is not opinionated with regard to how you use Spring. That's because as soon as you form a strong opinion toward one library, templating engine, or whatever, you shut out a lot of other options. Flexibility is the key.

Even so, there *are* more opinionated frameworks layered on top of Spring and Spring Boot. You mentioned Grails; Grails 3.0 is nothing but a layer on top of Spring Boot with an opinionated programming model around how controllers, models, and templates are created. There's also JHipster, an opinionated framework on top of Spring Boot that provides for how to build Spring apps with Angular front-ends. Those are two that come to mind, but I'm sure there are more. (There's also Spring Roo, while not built on top of Spring Boot, is a layer on top of Spring itself that is very opinionated with regard to templating and model creation...and the use of AspectJ.)

I don't doubt the productivity you described with Symfony. But I could show you similar productivity stories in Spring Boot. In fact, I can easily imagine a rapid development of a large scale (>100 entities, using the metric you cite) app using Spring Boot + Spring Data JPA + Spring Data REST + Lombok and leaving the templating choice up to the developer (or pushing UI work into a JS framework such as Angular).

Having seen other threads where you've brought up the same question before, I'm not sure anything I've said will sway your opinion. And that's okay. You favor a strongly opinionated stack (which you can still build...explicitly or implicitly...on top of Spring Boot), whereas Spring and Spring Boot favor flexibility. At the end of the day, neither of us is wrong...we just differ in opinion.
    Bookmark Topic Watch Topic
  • New Topic