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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:51:02+00:00 2026-06-01T12:51:02+00:00

Im creating a ServiceMix module that consists of a Camel route. In my beans.xml,

  • 0

Im creating a ServiceMix module that consists of a Camel route.

In my beans.xml, I have:

<osgix:cm-properties id="companyProps"
    persistent-id="com.company.integration">
</osgix:cm-properties>

<ctx:property-placeholder location="
    file:${karaf.base}/etc/com.company.integration.cfg
" />

This means I can define other items using properties from the file, like:

<http-conf:conduit name="*.http-conduit">
    <http-conf:authorization>
        <security:UserName>${username}</security:UserName>
        <security:Password>${password}</security:Password>
    </http-conf:authorization>
</http-conf:conduit>

I can also access the properties in my java classes if I create a bean and inject it:

<bean id="myConfig" class="com.company.integration.MyConfig">
    <osgix:managed-properties persistent-id="com.company.integration" />
</bean>

The problem is when Im writing my unit tests. Currently Im using a copy of my beans.xml with test values, but of course I’d like to use the real beans.xml and supply values for the properties.

public class myTest extends CamelSpringTestSupport
{
@Override
protected AbstractXmlApplicationContext createApplicationContext()
{
    return new ClassPathXmlApplicationContext(new String[] {
            "/META-INF/spring/beans.xml"
        ,   "/META-INF/spring/test.xml"
    });

}   
}

I’d like to get rid of test.xml and preferably load the test-properties from a property file.
I’ve seen some references to PropertyComponent, but Im unable to get this to work 🙁

  • 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-01T12:51:03+00:00Added an answer on June 1, 2026 at 12:51 pm

    In our organization, we separate our spring-osgi configuration from our spring bean configuration.

    In our spring-osgi configuration we would have the following:

    <osgix:cm-properties id="companyProps" persistent-id="com.company.integration">
        <prop key="name">value</prop>
        <prop key="name">value</prop>
        ...
    </osgix:cm-properties>
    

    as well as any osgi-specific configuration (such as service registration, events, etc.)

    In our spring-bean configuration, we define all the beans that we COULD use outside of an osgi container, including camel routes/context etc.

    For our testing, we start a ClassPathXmlContext using our spring bean definition and a test spring configuration that contains the following:

    <ctx:property-placeholder location="classpath*:test.properties" />
    

    As well as any mocks that we need for the osgi specific beans.

    Hope this helps.

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

Sidebar

Related Questions

Creating a Windows Forms Application in C#, I have a program that I am
Creating custom IHttpModules, I have realized that the requests for static files (e.g.: .css
Creating liquid layouts is an immense pain. Now, I totally understand that tables should
Creating a JApplet I have 2 Text Fields, a button and a Text Area.
Error creating bean with name 'sessionFactory' defined in class path resource [ApplicationContext.xml]: Invocation of
Creating a Blackberry app. Just a beginner, I have searched but couldn't find a
Creating a Drawable that is completely empty seems like a common need, as a
Creating a login page in xcode 4.2 I have the users fill out information
Creating an index MySQL After I have added the FULLTEXT index, how do I
Creating a CMS, I have a settings table, in which I store many CMS

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.