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 8716755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:09:42+00:00 2026-06-13T06:09:42+00:00

I have a spring datasource as following, in core module with its own spring

  • 0

I have a spring datasource as following, in core module with its own spring context i don’t want to set maxActivetime

<bean id="wssModelDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="net.sourceforge.jtds.jdbcx.JtdsDataSource"/>
    <property name="url" value="com.wss.jdbc.ConnectionUrl=jdbc:jtds:sqlserver://x-x2/x_control_QA;appName=wss;sendStringParametersAsUnicode=false;loginTimeout=20;socketTimeout=180"/>
    <property name="username" value="xxx"/>
    <property name="password" value="xxx"/>
  </bean>

I have dependent module which depends upon core module which have its own spring context and in this component i want to set datasource maxIdle time

<property name="wssModelDataSource.maxIdle" value="40"/>

and there are many other modules which also depend upon wssModelDataSource but i dno’t want to change maxIdle time for them.

my question is if i put <property name="wssModelDataSource.maxIdle" value="40"/> at the root of spring context file it gives me error

  • 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-06-13T06:09:44+00:00Added an answer on June 13, 2026 at 6:09 am
    <bean class="com.wss.spring.DataSourcePropertyOverrider" >
        <property name="maxIdle" value="#{com.wss.jdbc.MaximumIdleConnections}"/>
        <property name="minIdle" value="#{com.wss.jdbc.MinimumIdleConnections}"/>
        <property name="initialSize" value="#{com.wss.jdbc.InitConnectionSize}"/>
          </bean>
    

    Create BeanFactoryPostProcessor implementation and override postProcessBeanFactory method

    public class DataSourcePropertyOverrider implements BeanFactoryPostProcessor {
    
        private int maxIdle;
        private int minIdle;
        private int initialSize ;
        /**
         *
         * @param beanFactory
         * @throws BeansException
         */
        public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
            BasicDataSource dataSource  = (BasicDataSource)beanFactory.getBean("wssModelDataSource");
    
            if(dataSource != null){
                dataSource.setMaxIdle(maxIdle);
                dataSource.setMinIdle(minIdle);
                dataSource.setInitialSize(initialSize);
            }
    
            //To change body of implemented methods use File | Settings | File Templates.
        }
    
    
        public int getMaxIdle() {
            return maxIdle;
        }
    
        public void setMaxIdle(int maxIdle) {
            this.maxIdle = maxIdle;
        }
    
        public void setMinIdle(int minIdle) {
            this.minIdle = minIdle;
        }
    
        public int getMinIdle() {
    
            return minIdle;
        }
    
        public int getInitialSize() {
            return initialSize;
        }
    
        public void setInitialSize(int initialSize) {
            this.initialSize = initialSize;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following partial spring context xml file: <bean name=template class=org.springframework.jdbc.core.JdbcTemplate> <property name=dataSource
I have the following code that works fine in my spring.xml... <beans:bean id=sessionFactory class=org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean>
I'm using Spring and struts and have the following entry in 'C:/source/webapp/WebContent/META-INF/context.xml' with tokens
Background: I have a Spring 2.5/Java/Tomcat application. There is the following bean, which is
I have a Spring Batch process which has following kind of code. <step id=step1
I have a spring bean that I get like this within a method- repAppCaller
I have a spring web application that is required to work as following the
I have the following code in a Spring JdbcTemplate based dao - getJdbcTemplate().update(Record Insert
I have the following class: class Address { public string City {get; set;} public
I have the following structure: common-module Contains the common module related , services and

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.