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

  • SEARCH
  • Home
  • 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 642389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:09:57+00:00 2026-05-13T21:09:57+00:00

I am working on profiling a legacy application using Spring AOP and I want

  • 0

I am working on profiling a legacy application using Spring AOP and I want to get some data points around a decision I need to make.

This is what I have done so far:
I have created the code and configuration using Spring AOP which would help me to profile the beans that are being managed by the Spring container.

While profiling the dao layer, I find that the legacy app uses c3p0 framework – specifically, the ComboPooledDataSource class. Since this class is a final class, I am unable to work work with Spring AOP any longer- since cglib cannot create proxies for final classes!

Faced with this roadblock, I am planning to use aspect compile time weaving technique.
I want to know if this is the right decision or are there other ways to overcome this problem using Spring AOP itself. Please let me know.

Configuration info:

<bean id="sample_dao" class="com.foo.SampleDaoImpl">
  <property name="dataSource" ref="sample_data_source"/>
  ..
  <property name="sampleProperty" ref="sample_bean"/>
</bean>

   <bean id="sample_data_source" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close" depends-on="some_sample">
  <property name="driverClass" value="${driverClassName}"/>
  <property name="jdbcUrl" value="${url}"/>
  <property name="user" value="${username}"/>
  <property name="password" value="${password}"/>
  <property name="initialPoolSize" value="1"/>
  <property name="maxPoolSize" value="4"/>
  <property name="acquireIncrement" value="1"/>
  <property name="preferredTestQuery" value="select 1 from sample_table"/>
  <property name="idleConnectionTestPeriod" value="30"/>
  <property name="testConnectionOnCheckin" value="true"/>
  <property name="acquireRetryAttempts" value="3"/>
  <property name="connectionCustomizerClassName" value="com.foo.SampleConnectionCustomizer"/>

  • 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-13T21:09:58+00:00Added an answer on May 13, 2026 at 9:09 pm

    Depending on whether or not you already use AspectJ in your project, you might find the following approach simpler:

    Wrap your ComboPooledDataSource instance in a non-final decorator class instance; cglib should be able to proxy the decorator without being any the wiser.

    Assuming – for the example’s sake – that the dataSource attribute from your SampleDaoImpl class is of type javax.sql.DataSource:

    public class ComboPooledDataSourceDecorator implements javax.sql.DataSource {
    
       private ComboPooledDataSource delegate;
    
       public void setDelegate(ComboPooledDataSource delegate) {
          this.delegate = delegate;
       }
    
       public Connection getConnection() {
          return delegate.getConnection();
       }
    
       // other methods of javax.sql.DataSource
    
    }
    

    Wire it into spring like this:

    <bean id="sample_data_source" class="mystuff.ComboPooledDataSourceDecorator">
       <property name="delegate">
          <bean class="com.mchange.v2.c3p0.ComboPooledDataSource">
             ...
          </bean>
       </property>
    </bean>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.