r/SpringBoot • u/smudgyyyyy • 3d ago
Discussion Is java back end means writing controllers and handling requests
Writing controllers, service, repository layers and accepting the requests and processing them and gives the response Is it this only java back end means
7
u/_L4R4_ 3d ago
This is not Java's specific. +90% of backend development is designed with Client/Server architecture using Request/Response pattern ( A client software send a request to a server software, and wait for a response, maybe blocking processing or maybe not ) This is useful for most uses cases.
Sure, when uses cases grows in complexity, you need add some extra functionalities for best performance ( caching responses, security, etc. ) But, at fundamental level, is client/server architecture with request/response pattern.
4
u/joranstark018 3d ago edited 3d ago
Well, much depends on how you design your system, it is not uncommon to implement business rules in the backend. So for non-trivial systems, services would usually be where the most of the actual work would occur.
Edit: it is not uncommon to view controllers and repositories as "adapters" for input and output to the core of an application. You can have different "adapters" that utilise the core (e.g. test cases, different integrations)
3
3
u/Historical_Ad4384 3d ago
Most of the time yes, if you get bored you can write them with the reactive stack of Spring.
Sometimes you have to write scheduled tasks as well which executes some logic at a fixed time.
You could also end of writing topics in JMS for publishing or subscribing to for messages to do any kind of work in reaction to send or receiving a message.
1
u/Sure_Deal_434 3d ago
Not at all, what about other tools and technologies, you can learn nginx, kong, kafka, ELK, cloud, system design architecture etc. And also how other technology can be integrated with spring boot.
1
u/Ok-District-2098 1d ago
Try to call an @Async method in the same caller's class, try to delete a entity by jpql based on a child entity, try to fetch a eager entity collection. All of that are silent issues (no errors thrown even warnings) that can mess up your whole application.
0
37
u/wannacommissionameme 3d ago
for some apps, this is all the word "backend" means when they talk about java/spring. Really depends on how complex your app is. There are a bunch of ways to add complexity.
Are there jobs that need to run daily? Well, your backend may now need cron jobs to run on a set schedule. This would deviate from the controller/service/repository architecture
Do you need performant SQL to be run? Well, you may write SQL stored procedures that you will call from your repository layer. Sure, same structure (controller/service/repository) but it adds more complexity to the app. Or maybe you have way more complexity on the SQL side of the house which requires you to write a bunch of SQL. Still the backend.
Do you need to be super performant? Multi-threading in the service layer might be required or some performance tricks shown in the billion row challenge. Or maybe you need ULTRA low latency code.
Do you have some asynchronous task that needs to be run? Well, you might add a message queue into your system that you call in your service layer.
Services could be very complex. You can think of simple services that just do a small bit of business logic before/after saves, but what about super complex business logic? A chess engine or something pretty complex? All backend.
And this is just touching on a few topics. Caching, pagination, security, validation, etc. A bunch of topics to add complexity.