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

The Archive Base Latest Questions

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

I have an xml in 3.0 like so: <bean id=dataSource destroy-method=close class=org.apache.commons.dbcp.BasicDataSource> <property name=driverClassName

  • 0

I have an xml in 3.0 like so:

        <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
            <property name="driverClassName" value="${jdbc.driverClassName}" />
            <property name="url" value="${jdbc.internal.url}" />
            <property name="username" value="${jdbc.internal.username}" />        
            <property name="password" value="${jdbc.internal.password}"/>
        </bean>

I want to convert this to 3.1 while making use of the beans:profile However, when I try to change it to this:

        <beans profile="dev">
          <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
              <property name="driverClassName" value="${jdbc.driverClassName}" />
              <property name="url" value="${jdbc.internal.url}" />
              <property name="username" value="${jdbc.internal.username}" />        
              <property name="password" value="${jdbc.internal.password}"/>
        </bean>
        </beans>

I get errors like:

Invalid content was found starting with element 'bean'. One of '{"http://www.springframework.org/schema/beans":beans}'

Question

How can I make use of the beans:profile so that this particular bean definition only gets called when the active profile is dev

Update
My beans definition is:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.1.xsd
       http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd">
  • 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-14T08:42:12+00:00Added an answer on June 14, 2026 at 8:42 am

    You must put all nested <beans> declarations at the very end of the configuration file. This is how XML schema is defined and you have to obey this.

    See also

    • Spring Framework 3.1 M1 released:

      spring-beans-3.1.xsd has been updated to allow this nesting, but constrained to allow such elements only as the last ones in the file.

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

Sidebar

Related Questions

I have used beans:profiles in my xml like this: <beans profile=dev> <bean id=dataSource destroy-method=close
I have a properties file defined in my xml: <bean class=org.springframework.beans.factory.config.PropertyPlaceholderConfigurer> <property name=location value=/WEB-INF/db.properties></property>
<bean id=sessionFactory class=org.springframework.orm.hibernate3.LocalSessionFactoryBean> <property name=dataSource ref=dataSource/> <property name=mappingResources> <list> <value>product.hbm.xml</value> </list> </property> <property name=hibernateProperties>
I have a bean mongoService which looks like as <?xml version=1.0 encoding=UTF-8?> <beans xmlns=http://www.springframework.org/schema/beans
Let's suppose I have xml like this one: <Server Active=No> <Url>http://some.url</Url> </Server> C# class
I have a hibernate.cfg.xml file, but I'd like to reference it as a dataSource
I have xml like this: <rule> <word>I</word> <word>need</word> <word>more</word> <marker> <word>money</word> </marker> <word>now</word> </rule>
I have xml like this: <configurationData> <path name='b'> <path name='a'> <setting name='s1'> ![CDATA[XXXX]] </setting>
I have XML like, <items> <item> <products> <product>laptop</product> <product>charger</product> <product>Cam</product> </products> </item> <item> <products>
If I have XML like: <foo> <bar id=1 score=192 /> <bar id=2 score=227 />

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.