Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6078581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:51:00+00:00 2026-05-23T10:51:00+00:00

I work with Spring Framework 3.0.5 and Id like to understand the basic principals

  • 0

I work with Spring Framework 3.0.5 and Id like to understand the basic principals of Spring. One of it is AOP.

One basic idea of the spring framework is to keep the objects itself simple and to have clear code.

DI follows this basic idea. It provides clear code and the objects itself can be very simple. The dont have to look up their dependencys.

Now what about AOP: I mean, code is for sure clearer with AOP, but does AOP also have the basic idea of keeping the objects as simple as possible? Im not sure of that, thats why Id like to know some other opinions 🙂

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T10:51:00+00:00Added an answer on May 23, 2026 at 10:51 am

    Take the following code snippets as an example. The easy way:

    @PersistenceContext
    private EntityManager em;
    
    @Transactional
    public void save(Object obj) {
        em.persist(obj);
    }
    

    The traditional way (you can manage transactions using EntityManager interface, but that is not the point):

    @PersistenceContext
    private EntityManager em;
    
    @Resource
    private AbstractPlatformTransactionManager transactionManager;
    
    public void save(final Object obj) {
        new TransactionTemplate(transactionManager).execute(new TransactionCallbackWithoutResult() {
            @Override
            protected void doInTransactionWithoutResult(TransactionStatus status)
            {
                em.persist(obj);
            }
        });
    }
    

    What does it have to do with AOP? Transaction management is one of the most widely used examples of AOP and Spring is not an exception. The former code snippet uses @Transactional annotation to apply transaction demarcation using aspect, while the latter manages transactions manually. See the benefit?

    The key thing: use aspects for cross-cutting concerns like logging, profiling, etc. Don’t build your business logic in aspects. This way your beans remain clear while irrelevant code from business perspective is hidden in the aspect.

    Also AOP allows you to do all sorts of sophisticated stuff with ease. Take for instance HTTP session handling – with session bean scope and AOP proxying you can access session without even realizing it.

    To summarize – it is great tool when used for the right job.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I work on an legacy application, where Spring AOP (namely ProxyFactoryBean ) is used.
i am trying to understand how DateTime.ToString(Date pattern) work in .net framework, C#. I
I have a framework with objects and data access code. This objects are mapped
I have a Java servlet container using the Spring Framework. Pages are generated from
For our current project, we are integrating JSF and the Spring Framework. I'd like
I have a framework which currently requires pretty verbose setup in Spring: <bean id=dpHibernateRemotingAdapter
I have an application built on the Spring Framework that uses an external properties
I've read through all of the Spring 3 Web docs: http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/spring-web.html but have been
I'm trying to integration test my application with Spring TestContext framework. I have done
I work on Spring MVC + Hibernate application, use MySQL (ver. 5.0.51a) with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.