mvn -P dev
If I build my project using profile dev, then I want to use dev.properties in my spring bean like below. Is it possible ? If so , how could
You can use Maven profiles to add a 'profile' property to the build:
dev
dev
Then pass the value into your application using a system property, here's an example with surefire:
maven-surefire-plugin
${profile}
Finally this can be referenced in you application:
Alternatively, if you are using Spring 3.1 or later you might find the XML profile feature meets your needs (although it may be overkill).