org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource
[org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is
java.lang.IllegalStateException: Can't configure anyRequest after itself
dependencies {
compile project(':commons:autoconfigure')
compile project(':commons:commons')
compile project(':commons:commons-services')
compile project(':commons:jwt-filter')
compile "javax.cache:cache-api"
compile "com.hazelcast:hazelcast-spring"
compile group: 'com.hazelcast', name: 'hazelcast-eureka-one', version: '1.0.2'
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-security"
compile "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client"
compile "org.apache.commons:commons-lang3:${commons_lang_version}"
compile "io.jsonwebtoken:jjwt:${jwt_version}"
compile "co.wrisk.logback:logback-ext-jackson:${logback_cloudwatch_appender_version}"
compile "io.opentracing.contrib:opentracing-spring-jaeger-cloud-starter:1.0.1"
compile "com.fasterxml.jackson.core:jackson-databind:2.9.10"
compile "com.google.guava:guava:${guava_version}"
compileOnly "org.projectlombok:lombok"
compileOnly "org.springframework.boot:spring-boot-configuration-processor"
}
buildDocker {
dockerfile {
contextDir = new File(project.buildDir, "libs")
env ("EUREKA_HOST", "http://eureka:8888/config/eureka/")
env ("SPRING_DATA_MONGODB_URI", "mongodb://mongo:27017/?retryWrites=true")
env ("SPRING_PROFILES_ACTIVE", "prod")
env ("TZ", "US/Eastern")
expose (1180)
add (project.file('entrypoint.sh'))
add (project.getName() + '-' + project.getVersion() + '-boot.jar', '/' + project.getName() + '.jar')
entrypoint (["/entrypoint.sh"])
healthCheck (10, 5, 5, 360, 'curl 127.0.0.1:1180/api/sisense/actuator/health -f -s || exit 1')
}
}
springBootVersion = "2.2.2.RELEASE"
springCloudVersion = "Hoxton.RC1"
Comment From: wilkinsona
This is a problem with your Spring Security configuration. The failure message is the following:
Can't configure anyRequest after itself
You haven’t shared the configuration so I can’t say what the problem with it might be. As we’ve said before, and as mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. This sort of problem really belongs on Gitter or Stack Overflow. Please follow up there and we and the rest of the Spring Community will do our best to help.
Comment From: sumit-gurav
dependencies {
compile project(':commons:autoconfigure')
compile project(':commons:commons')
compile project(':commons:commons-services')
compile project(':commons:jwt-filter')
compile "javax.cache:cache-api"
compile "com.hazelcast:hazelcast-spring"
compile group: 'com.hazelcast', name: 'hazelcast-eureka-one', version: '1.0.2'
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-security"
compile "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client"
compile "org.apache.commons:commons-lang3:${commons_lang_version}"
compile "io.jsonwebtoken:jjwt:${jwt_version}"
compile "co.wrisk.logback:logback-ext-jackson:${logback_cloudwatch_appender_version}"
compile "io.opentracing.contrib:opentracing-spring-jaeger-cloud-starter:1.0.1"
compile "com.fasterxml.jackson.core:jackson-databind:2.9.10"
compile "com.google.guava:guava:${guava_version}"
compileOnly "org.projectlombok:lombok"
compileOnly "org.springframework.boot:spring-boot-configuration-processor"
}
buildDocker {
dockerfile {
contextDir = new File(project.buildDir, "libs")
env ("EUREKA_HOST", "http://eureka:8888/config/eureka/")
env ("SPRING_DATA_MONGODB_URI", "mongodb://mongo:27017/?retryWrites=true")
env ("SPRING_PROFILES_ACTIVE", "prod")
env ("TZ", "US/Eastern")
expose (1180)
add (project.file('entrypoint.sh'))
add (project.getName() + '-' + project.getVersion() + '-boot.jar', '/' + project.getName() + '.jar')
entrypoint (["/entrypoint.sh"])
healthCheck (10, 5, 5, 360, 'curl 127.0.0.1:1180/api/sisense/actuator/health -f -s || exit 1')
}
}
Comment From: sumit-gurav
buildscript {
ext {
springBootVersion = "2.2.2.RELEASE"
springCloudVersion = "Hoxton.RC1"
}
repositories {
maven { url "http://artifactory.hhstechgroup.com:8081/artifactory/repo" }
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/release" }
maven { url "http://repo.spring.io/plugins-release" }
}
dependencies {
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:4.7.5")
classpath("io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE")
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.owasp:dependency-check-gradle:5.2.2")
}
}
plugins {
id "ch.netzwerg.release" version "1.2.5"
id "se.eugenekainara.docker" version "1.3.1"
id "org.sonarqube" version "2.6.2"
id "com.gorylenko.gradle-git-properties" version "1.4.17"
}
group = "com.hhstechgroup.provider-management"
allprojects {
apply plugin: "com.jfrog.artifactory"
apply plugin: "docker"
apply plugin: "idea"
apply plugin: "io.spring.dependency-management"
apply plugin: "jacoco"
apply plugin: "java"
apply plugin: "maven"
apply plugin: "maven-publish"
apply plugin: "org.owasp.dependencycheck"
repositories {
//Download sources will not work if mavenLocal() is uncomment
// mavenLocal()
maven { url "http://artifactory.hhstechgroup.com:8081/artifactory/local" }
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/release" }
}
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
}
subprojects {
sourceCompatibility = 10
targetCompatibility = 10
group parent.group
version parent.version
dependencies {
compileOnly "org.projectlombok:lombok:${lombok_version}"
compile group: 'io.opentracing.contrib', name: 'opentracing-spring-cloud-mongo-starter', version: '0.3.11'
testCompile "de.flapdoodle.embed:de.flapdoodle.embed.mongo:${embeded_mongo_version}"
testCompile "org.springframework.boot:spring-boot-starter-test"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junit_version}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junit_version}"
compile "javax.xml.bind:jaxb-api:2.3.0"
compile "org.glassfish.jaxb:jaxb-runtime:2.3.0"
compile "javax.activation:javax.activation-api:1.2.0"
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}
jacoco {
toolVersion = "0.8.2"
}
sonarqube {
properties {
property "sonar.java.source", "10"
}
}
test {
useJUnitPlatform()
testLogging {
events 'FAILED', 'SKIPPED'
}
jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED', '--illegal-access=warn'
systemProperty 'spring.data.mongodb.port', '0'
}
artifacts {
archives sourcesJar
}
publishing {
publications {
maven(MavenPublication) {
from components.java
artifact (sourcesJar) {
classifier = "sources"
}
}
}
}
artifactory {
contextUrl = "http://artifactory.hhstechgroup.com:8081/artifactory"
publish {
repository {
repoKey = version.matches("(.*)SNAPSHOT") ? "libs-snapshot-local" : "libs-release-local"
username = "${System.getenv('ARTIFACTORY_USR')}"
password = "${System.getenv('ARTIFACTORY_PSW')}"
maven = true
}
defaults {
publications("maven")
}
}
}
artifactoryPublish.dependsOn build
docker {
baseImage 'registry.hhstechgroup.com/general/jre-alpine'
maintainer 'Dev Ops "DevOps@HHSTechGroup.com'
}
}
// Projects with Spring Boot app
configure([project(':audit'), project(':raccoon'), project(':screening-service'),
project(':provider-management'), project(':applications'),
project(':fabric-client'), project(':initial-data'), project(':reporting'), project(':sisense-gateway')]) {
apply plugin: "org.springframework.boot"
dependencies {
runtime("io.micrometer:micrometer-registry-prometheus")
compile("net.logstash.logback:logstash-logback-encoder:${logstash_logback_encoder_version}")
}
jar {
enabled = true
}
bootJar {
classifier = 'boot'
}
task buildDocker(type: Docker, dependsOn: build) {
push = project.hasProperty("push")
tagVersion = !version.matches("(.*)SNAPSHOT") ? project.getVersion() : System.getenv('BRANCH_NAME') ?: "develop"
tag = 'registry.hhstechgroup.com/provider-management/' + project.getName()
stageDir = new File(project.buildDir, "libs")
}
}
release {
dependsOn ':fabric-client:buildDocker', ':initial-data:buildDocker',
':applications:buildDocker',':audit:buildDocker',':raccoon:buildDocker',':screening-service:buildDocker',
':provider-management:buildDocker',':reporting:buildDocker', ':sisense-gateway:buildDocker', project.hasProperty("push") ? artifactoryPublish : build
push = project.hasProperty("push")
tagPrefix = ""
}
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = subprojects.test
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(subprojects.sourceSets.main.output)
executionData = files(subprojects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
}
onlyIf = {
true
}
doFirst {
executionData = files(executionData.findAll {
it.exists()
})
}
}
apply from: "gradle/tasks/logging.gradle"
apply from: "gradle/tasks/utils.gradle"
Comment From: wilkinsona
@sumit-gurav Please take the time to read our replies before commenting again. As I said above, the problem appears to be with your Spring Security configuration. It is unrelated to your Gradle build scripts. Even if it were related to those scripts, posting them (and duplicating content from an earlier comment) with no additional context is a waste of our time and of yours.
There are over 3000 people watching this repository and each time you comment on an issue they will receive a notification or email. Please be considerate of that when posting issues and comments and respect our preference that problems like this are posted on Stack Overflow or Gitter.