st.
st.

Reputation: 87

How to generate RestController classes

I am writing Spring Boot application in intelliJ-IDEA, and have database with many tables on MySQL server. I generated Entity classes from database (Hibernate).

Is there a way to generate Repository classes from Entity classes, and then to generate RestController classes from Repository classes?

Or is there a way to generate RestController classes directly from Entity classes or from database?

I don't want to write all that RestController classes for whole database.

Upvotes: 4

Views: 1155

Answers (1)

lgu
lgu

Reputation: 2435

Telosys code generator (http://www.telosys.org) does this kind of job.

It uses the database schema to create a lightweight model that is used to generate the Java code. There are some predefined templates available on GitHub (https://github.com/telosys-templates-v3) for JPA, POJO, REST controllers, Spring MVC, etc The advantage is that everything is generated with a single tool.

You can use the command line tool (http://www.telosys.org/cli.html) or the Eclipse plugin (http://marketplace.eclipse.org/content/telosys-tools)

Some interesting articles about code generation with Telosys :

Upvotes: 2

Related Questions