1

We are running on spring boot version 1.5.10

JDK : 1.8.0.52

Our gradle file has the entry

compile group: 'org.springframework.security', name: 'spring-security-web', version: '4.2.3.RELEASE'

We have disabled it in our application.properites through

management.security.enabled=false

We use application-production.properties to set production variables

When we run in production environment the value is not affected

Do we need to explicitly set it again in application-production.properties?

jibsonline
  • 11
  • 5
  • I assume you are enabling the production profile so that `application-production.properties` are being picked up – Darren Forsythe Sep 06 '18 at 09:25
  • @DarrenForsythe yes... we set the environment as "production" and values are picked from application-production.properties. What I am trying to figure out is that whether I need to explicitly set "management.security.enabled=false" in application-production.properties or application.properties will suffice – jibsonline Sep 06 '18 at 09:33
  • no you don't, properties get inherited. – Darren Forsythe Sep 06 '18 at 09:44

1 Answers1

0

You can use many profiles and split you settings to any files. For default start application will be gived all settings from application.properties, for production run with "production"-profile and wil be added to default new setttings from application-production.properties fot test will user application-test.properties and run with test profile command.

Add to pom.xml something like this style

<profiles>
    <profile>
        <id>h2</id>
        <properties>
            <activatedProperties>h2</activatedProperties>
        </properties>
    </profile>
    <profile>
        <id>postgres</id>
        <properties>
            <activatedProperties>postgres</activatedProperties>
        </properties>
    </profile>
</profiles>

In application.properties locate spring.profiles.active=@activeProfiles@ and run with profile

Or you can use only one setting file = one profile, see example https://stackoverflow.com/a/25674407/2662111

Steklorez
  • 109
  • 1
  • 4