Vimal David
Vimal David

Reputation: 585

How to configure spring profiles in Netbeans?

I am running a Spring boot Java app in Netbeans 9.0 which has two profiles (test, production). I need to run the project in 'test' profile instead of the 'default'

I have tried the following setups

Setup 1

Project (Right click) > Properties > Run > Arguments

-Dspring.profiles.active=test

Setup 2

Project (Right click) > Properties > Actions > Run Projects > Activate Profiles

test

The configuration doesn't work correctly and I am getting the following message

"No active profile set, falling back to default profiles: default"

Could you please help me to set up this configuration

Upvotes: 3

Views: 4209

Answers (3)

hazazs
hazazs

Reputation: 49

I suppose you have installed this plugin to NetBeans.
Then right click on the Project -> Properties:

enter image description here

Important: The argument starts with "--" (not "-D") since it's a spring boot command.

Upvotes: 0

Razvan Mahalean
Razvan Mahalean

Reputation: 56

After poking around a bit, I found that from Netbeans 8.1 and up you can do the following to set a Spring profile:

Right click your application -> Run Maven -> Goals -> In the "Properties" section set:

-Dspring.profiles.active={your profile name here}

This worked for me.

Upvotes: 2

lakshmanvvs
lakshmanvvs

Reputation: 81

Have you tried configuring profiles in the application.properties or application.yml in your spring boot app?

Please read this documentation Spring Boot Profiles

Upvotes: 0

Related Questions