javaherokuspring-securityspring-boot-gradle-plugin

SpringBoot security on heroku-deployed project even without using its dependency


I am using java 1.8 for Gradle SpringBoot restAPI.
I haven't used spring-boot-starter-security and API works accordingly but after deploying the same code on heroku the API asks for the signup.

Sign in for Springboot application

I tried disabling it via following way,

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;

@SpringBootApplication (exclude = { SecurityAutoConfiguration.class })
public class LawCaseApplication {

    public static void main(String[] args) {
        SpringApplication.run(LawCaseApplication.class, args);
    }

}

But still after re-deploying the screen appeared. Then I tried giving it my own user name and password by writing the following in the application.properties as I wasn't getting any randomly generated password in the logs too,

spring.security.user.name="user"
spring.security.user.password="user"

And I am still getting this screen.

However, the dependencies I used are,

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.projectlombok:lombok:1.18.20'
    runtimeOnly 'org.postgresql:postgresql'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    implementation "org.jsoup:jsoup:1.13.1"
    implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
}

I repeat that there is no security when run on local host but on the heroku deployed version.


Solution

  • Actually, there is a most important step before you redeploy each time. build the jar/war file so that it gets updated by the recent changes you made...

    The steps you used are working on localhost proving them to be correct... Try building the jar/war file then check if it works or not...