1

I need to create multiple context for the same application context.xml file and each context use its own application.properties.

How to do it using spring boot ?

I have 3 clients who have the same behaviour but each one with specific details declared into client-application.properties.

So i use also spring integration and the flow will be reused for each client . I need to launch 3 clients in the same time and each one with its own application.properties. And i use xml for that.

7
  • Take a look at spring profiles. How do you want to manage your contexts - as xml or as java classes? Commented Jun 22, 2016 at 13:07
  • 1
    Ehm why, what is the use case for this? Commented Jun 22, 2016 at 13:07
  • i updated my question. Please help me to find a solution, it is very urgent Commented Jun 22, 2016 at 13:15
  • 1
    Just start the application 3 times. Specifying an additional config file for each. Don't try to hack around, work with the framework. Commented Jun 22, 2016 at 13:19
  • is it a safe solution if i start the application 3 times (i speak about performance)? because the application belongs to a group and they require to have a common application launched on the same machine for all affiliates, each affiliate has its own configuration but they have the same behaviour. Commented Jun 22, 2016 at 13:28

1 Answer 1

1

Take a look at this... I have a single project, and inside of it are three application.properties (or the number you need)

in application.properties, i specify general parameters

enter image description here

and in each application-.properties i specify specific environment properties, e.g., the port in production:

enter image description here

And the port for my dev profile:

enter image description here

In order to use them check the documentation that Ivaylo recommended

...A small example:

enter image description here

In this case, the application will boot on the port showed in the different .properties files.

You can specify the profile like: mvn spring:boot run -Dspring.profiles.active=dev

Sign up to request clarification or add additional context in comments.

2 Comments

i use xml to configure context.xml, so for the <property placeholder location=?/> what should i write and i note that all aplication.properties are externalized

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.