0

and if not what are more things that we can do with spring boot?

i know that we can build a whole web app(frontend and backend) in one spring boot application in the folder resource/template and resource/static but in the real world does somebody uses this method to create web application with the resource/template and resource/static?

and one more question what is used in the real world hibernate(with the SessionFactory or EntityManager) or JpaRepository in the spring data jpa?

y0bu
  • 87
  • 1
  • 7

2 Answers2

2

No Spring Boot isn't just for REST APIs.

Spring Boot is "just" a mechanism for autoconfiguring a Spring Framework based application. Therefore you can use and it does get used for all kinds of stuff.

  • REST APIs for webservices
  • Full web application using Spring MVC
  • SOAP services (or are they called SOAP dispensers?)
  • Reactive web applications
  • Command line tools
  • Batch jobs
  • Swing / JavaFX applications ...

Of course there are many more people writing web applications than Swing applications with or without Spring.

The kind of web application you describe and which I put under "Full web application using Spring MVC" is a very well established model and when done right way better aligned with the principles of REST than the average so called REST service. My very personal guess is: They will still be around when nobody remembers what Angular is.

For your additional question: Your question sounds a little like the relation between JPA and Spring Data JPA might not be completely clear. (see Spring Data JDBC / Spring Data JPA vs Hibernate)

Both are certainly used in real world projects. By definition more projects use JPA than Spring Data JPA since the first is a superset of the later.

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
  • thanks you for answering my question but you didnt really answer the second question which is "but in the real world does somebody uses this method to create web application with the resource/template and resource/static?" or in the real world we just going to build an rest api and then we going to access the api with javascript with fetch()? – y0bu Apr 16 '20 at 09:25
  • I think I did answer that: "you can use and it does get used for [...] full web applications using Sprig MVC". Yes it does get used that way. – Jens Schauder Apr 16 '20 at 09:28
  • If you are interested in how to build such an application well, you might want to take a look at https://roca-style.org/ – Jens Schauder Apr 16 '20 at 09:30
1

This involves complete Spring history,

Actual motive of Spring was to enable loose coupling , so that unit tests can be easily performed . Spring MVC was for developing web applications with Model View Controller having their proper boundaries. Then Spring Boot which enabled developer to focus on business logic then configurations. That's why spring boot is a good choice for microservices.

For JPA or hibernate query , many people prefer using JPARepositoy as again you just have to define entity for the repository and Spring boot automatically provides you queries like findById and so on.

In short Spring boot have made it really easy to run the applications with different configurations and environment smoothly.

GK7
  • 116
  • 3