Generator-jhipster: [Feature] Create new, small sub-generators for Spring Boot

Created on 30 Sep 2017  路  8Comments  路  Source: jhipster/generator-jhipster

Our "jhipster entity" sub-generator generates a complete CRUD entity: that's good for a lot of reasons, but sometimes you just want to create a simple REST service. Not everything is a CRUD :-)

If you want smaller components:

  • We already have the "jhipster service" sub-generator, which generates a Spring service bean
  • On the client-side, you can use Angular CLI to generate components, routers, etc...

I would like to:

  • Add a new "jhipster spring-controller" sub-generator, which generates a simple Spring MVC REST controller
  • Rename the "jhipster service" to "jhipster spring-service"
  • Think about other use-cases: a "jhipster jpa-repository"?

This would be an easy work, which shouldn't have much impact elsewhere, but which could help a lot of people.

good first issue

Most helpful comment

@jdubois how about containing everything in a parent sub gen (Of course code wise each will be separate and we will just compose it from the parent) so that users don't have to remember every sub generator and it will be easier to advertise and drive adoption.
I propose jhipster component which will ask the below question

What would you like to do?
1. Generate an entity
2. Generate a Spring service
3. Generate a Spring controller

Based on the answer we will just compose the appropriate sub gen and it will take it from there asking additional questions if any and generating the stuff

Advantages of this

  • Easier for people to remember
  • Easier adoption otherwise the option goes unnoticed like our Service generator which is rarely used
  • Possible to add more complex options like Generate a Spring controller with service for which we will just compose the controller sub gen followed by the service sub gen
  • -

All 8 comments

Could be a good thing for hacktoberfest

@jdubois how about containing everything in a parent sub gen (Of course code wise each will be separate and we will just compose it from the parent) so that users don't have to remember every sub generator and it will be easier to advertise and drive adoption.
I propose jhipster component which will ask the below question

What would you like to do?
1. Generate an entity
2. Generate a Spring service
3. Generate a Spring controller

Based on the answer we will just compose the appropriate sub gen and it will take it from there asking additional questions if any and generating the stuff

Advantages of this

  • Easier for people to remember
  • Easier adoption otherwise the option goes unnoticed like our Service generator which is rarely used
  • Possible to add more complex options like Generate a Spring controller with service for which we will just compose the controller sub gen followed by the service sub gen
  • -

@deepu105 Yes but that's just another sub-generator which is a "wrapper" of the others - no big deal here!
For my personal use-case, I'd rather have "jhipster spring-controller", I find it easier and quicker to use (and that would still be possible, so no problem).

I like the idea, this is similar to what Grails has and offers a good level of granularity of what will be generated. It happened to me to delete all the UI part for a given entity because it was not needed.
I would prefer a different command than answering questions like @jdubois mentioned.

Yes: at the beginning Grails (and RoR!!) where heavy sources of inspiration, we are going back to roots :-)

Hi @jdubois I am interested in this feature !!!

6502

Closing as we have a "spring-controller" sub-generator that was commited in the last release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shivroy121 picture shivroy121  路  3Comments

pascalgrimaud picture pascalgrimaud  路  4Comments

tomj0101 picture tomj0101  路  3Comments

SudharakaP picture SudharakaP  路  3Comments

dronavallisaikrishna picture dronavallisaikrishna  路  3Comments