2017-07-15 74 views
1

我有以下问题:ClassNotFoundException的使用Spring WebFlux安全

我试图建立含春Webflux和春季安全基本春天启动(2.0.0.M2)项目。

我的pom.xml看起来像这样(通过start.spring.io生成):

<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>2.0.0.M2</version> 
    <relativePath/> <!-- lookup parent from repository --> 
</parent> 

<dependencies> 
    ... 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-security</artifactId> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-webflux</artifactId> 
    </dependency> 
    ... 
</dependencies> 

SpringSecurityConfig:

@EnableWebFluxSecurity 
public class SecurityConfig extends WebFluxSecurityConfiguration {} 

我没有得到任何进一步的,因为我得到的启动异常:

Caused by: java.lang.ClassNotFoundException: org.springframework.security.web.server.context.SecurityContextRepository 

所以我认为整个org.springframework.security.web.server包是不是在cla sspath,虽然它应该在那里,因为它包含在API docs中。

似乎我做错了什么,但我不知道是什么。

+0

你要添加的依赖。 Afaik安全助焊剂罐不是'spring-boot-starter-security'的一部分。如果是尝试清除本地存储库并重新下载依赖关系。 –

+0

你说得对,它不是它的一部分。我期待这是因为它包含在Spring Security 5.0.0.M2 API文档中。谢谢! – Roen

+1

你能回答你自己的问题吗?这应该有助于社区中的其他开发人员。 –

回答