Springboot 1.5.10: включение URL-адреса работоспособности привода без проверки подлинности
Моему приложению требуется проверка подлинности сертификата клиента X509 для использования остальных служб, однако я пытаюсь включить конечную точку привода /health
без проверки подлинности сертификата клиента
Ниже мой build.gradle
buildscript {
ext {
springBootVersion = '1.5.10.RELEASE'
springVersion = '4.3.8.RELEASE'
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1"
}
}
dependencies {
compile "org.codehaus.groovy:groovy-all:2.3.9"
compile "org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}"
compile "org.springframework.boot:spring-boot-starter-tomcat:${springBootVersion}"
compile "org.springframework.boot:spring-boot-starter-logging:${springBootVersion}"
compile "org.springframework.boot:spring-boot-starter-jdbc:${springBootVersion}"
compile "org.springframework.boot:spring-boot-starter-security:${springBootVersion}"
compile "org.springframework:spring-webmvc:${springVersion}"
compile "commons-codec:commons-codec:1.10"
compile "com.microsoft:sqljdbc4:4.0"
compile "com.google.guava:guava:18.0"
compile "jcifs:jcifs:1.3.17"
}
Ниже приведен класс конфигурации, который я создал для обхода аутентификации сертификата lient для привода /health
конечная точка
@SpringBootApplication
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class AuthenticationService extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests().antMatchers("/health").permitAll()
.and()
.authorizeRequests().antMatchers("/**").authenticated()
}
@Bean(name = "mvcHandlerMappingIntrospector")
public HandlerMappingIntrospector mvcHandlerMappingIntrospector() {
return new HandlerMappingIntrospector();
}
}
ниже мой yaml config
server:
ssl:
client-auth: need
management:
health:
defaults:
enabled: false
Приведенный выше код прекрасно компилируется, но при запуске приложения появляется ошибка, приведенная ниже. Может ли кто-нибудь помочь исправить эту ошибку?
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcHandlerMappingIntrospector' defined in com.abc.SBApplication: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.handler.HandlerMappingIntrospector]: Factory method 'mvcHandlerMappingIntrospector' threw exception; nested exception is java.lang.IllegalArgumentException: ListableBeanFactory must not be null