Creating new Rest Controller
8904591612 opened this issue · 7 comments
Hii My requirement is such that I need to create a rest controller also , while scaffolding along with Model, Controller Repository , Service ,I went through the procedure that is used to generate the files given the command. I followed the same steps.
- I created the file "template-rest-controller.txt" in spring-boot-generate projects resources/templates/java/rest folder
- I created a java class RestGenerator.java inside br.com.generate.java.command.rest package.
- I created an object of same class in br.com.netodevel.scaffold.ScaffoldHandler.java
This is how I gave .
new RestGenerator().generate(nameClass, null, "template-rest-controller.txt");
But when I create a new project , it is not creating the rest controller .. What should I do I am unable to make out. Please Help
This is the link to my repository.
Hi @8904591612 , what is the output when executed generate?
It generates all files except the rest controller, the same way as it was generated before I made the changes.I mean the changes I have made are not getting reflected .
I ran your project and it is generating the rest file.
Output:
create src/main/java/br/com/example/model/UserModelModel.java
create src/main/java/br/com/example/repository/UserModelRepository.java
create src/main/java/br/com/example/service/UserModelService.java
create src/main/java/br/com/example/controller/UserModelController.java
create src/main/java/br/com/example/rest/UserModelRest.java
create /src/main/resources/templates/layout.html
create /src/main/resources/templates/usermodel/index.html
create /src/main/resources/templates/usermodel/form.html
create /src/main/resources/templates/usermodel/show.html
migration created migrations/create_UserModel_table.sql
@8904591612 Please use git flow, make a fork and when you finish your feature, open pull request.
Hii. Ya sure I will follow the conventions,I have a small confusion,From where should I compile the code. Currently I have in .m2 directory. I made the changes , ran "clean compile install" and created the new project and the scaffold, but the same ,my changes are not reflected, What should I do, since this is the first time I am editting a source code,Please help. What is mean I compiled the code by changing , but I am getting the same output are there any other changes I should make to run the code?
Thanks
@8904591612
try to execute these commands in order inside repository:
spring uninstall br.com.netodevel:spring-scaffold-cli:0.0.1-SNAPSHOT
mvn install
spring install br.com.netodevel:spring-scaffold-cli:0.0.1-SNAPSHOT
Hii. Thanks a lot I fixed the issue .My code was running from lib directory , which was the previous version, but latest code was in opt/spring-boot/spring-1.4.0.RELEASE/lib/ext directory. That was the issue.