Should I use Spring AOP?

I'm new to Spring, and I want to clarify something. I developed a student management application for private institutions. It can record student details (address, phone number, registered courses, grade, etc.), course information, student fees, report generation module, lecture information, etc.,

However, I have not used much of AOP to develop this application, except in rare cases, such as logging. But Spring AOP is a big part in Spring, according to my knowledge. My question is, is AOP a big part of Spring, or am I not enough places where I should have used it (I assume that I made a mistake for newcomers in not using AOP)? If so, can you explain to me where I should have used these concepts so that I can learn from my mistake.

+7
source share
6 answers

I think that I have actively used AOP in only a few projects over the years. In my work with Spring, I use it rarely compared to most other Spring functions. That way, I know about this and what he can do, but I'm not worried that I am not marking this particular box.

It is helpful to understand what it is and what it can do for you. However, Spring is already working on you that uses it, and you are likely to use it already without knowing it! Understanding AOP and how it works is a major issue here. So it looks like you covered it.

+4
source

My opinion is that AOP is great if you create a framework (for example, spring), as it allows the platform to implement end-to-end code that does not greatly affect users of the framework, for example, in spring:

@Transactional 

This one line of code in the service class invokes significant transaction management functionality.

However, for regular web applications (for example), user aspects should be used sparingly because:

+6
source

AOP is a big part in Spring according to my knowledge

Yes , this, since you are already using AOP for logging , for a better understanding of AOP read here on aop

Basically, the modularity of the application for separation of cross-cutting concerns. increased separation of cross-cutting concerns.

as it helped you participate during transaction management logging , etc.

AOP in Spring is used:

  • Providing declarative enterprise services such as declarative transaction management
  • So that users can implement custom aspects.

source

For my understanding, you can use transaction management in your application. since you maintain students , course , fee , etc. entries related to students.

+4
source

Spring AOP used to track all user activity in large business applications. Like a log using AOP, we can identify the classes and methods used by the user, and if any error occurs in any method, developers or client assistants can identify the problem soon and can give a solution soon than reading the log files.

+3
source

According to my information, I believe that spring aop plays a big role. This is often not used in all projects. But when you use, you will see how convenient it is to have aop.

take this example.

You are doing a few queries and you need a transaction. How do you usually deal with this? well, you will have to specifically make a transaction in your sql query, or you will have to put some code in the business logic to make sure that it is a transaction. But if you can do this using one annotation, how convenient is it? Also, posting things like logging inside your logic is not very good. This way, aop will handle all of these things separately so you don't have to mix all these things with your business logic.

I hope the above example is useful for you.

+3
source

Yes it is. As a spring developer, I also have not used it regularly in most projects, but it is used in the extended areas of spring development. And no matter what weather you used in the project or not. Over time, you will encounter situations where you need to use aop.

+2
source

All Articles