小编b.l*_*pes的帖子

需要一个无法找到的'org.springframework.security.core.userdetails.UserDetailsS​​ervice'类型的bean

使用mvn spring-boot启动时:运行甚至使用gradle返回该问题.



***************************
APPLICATION FAILED TO START
***************************

Description:

Field userDetailsService in webroot.websrv.auth.config.WebSecurityConfiguration required a bean of type 'org.springframework.security.core.userdetails.UserDetailsService' that could not be found.


Action:

Consider defining a bean of type 'org.springframework.security.core.userdetails.UserDetailsService' in your configuration.


BUILD SUCCESSFUL

Total time: 19.013 secs
Run Code Online (Sandbox Code Playgroud)

以下是主要类,所有要求对我来说都没问题,我正在使用org.springframework.boot发行版1.5.7.RELEASE


    package webroot.websrv.auth.config;


    @Configuration
    @EnableWebSecurity
    @EnableGlobalMethodSecurity(prePostEnabled = true)
    public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {

    @Autowired
    private JwtAuthenticationEntryPoint unauthorizedHandler;

    @Autowired
    private UserDetailsService userDetailsService;

    @Autowired
    public void configureAuthentication(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception {
        authenticationManagerBuilder
                .userDetailsService(userDetailsService)
                .passwordEncoder(passwordEncoder());
    }

    @Bean
    public PasswordEncoder passwordEncoder() { …
Run Code Online (Sandbox Code Playgroud)

spring-security autowired spring-boot

5
推荐指数
1
解决办法
2万
查看次数

ANGULAR 4路由问题:没有HttpClient的提供程序

嗨,我有一个登录组件,其中包含指向寄存器组件的链接.

当我点击此链接时,我遇到了这个问题:

ERROR Error: Uncaught (in promise): Error: No provider for HttpClient!
Error: No provider for HttpClient!
at injectionError (core.es5.js:1169)
at noProviderError (core.es5.js:1207)
at ReflectiveInjector_.webpackJsonp.../../../core/@angular/core.es5.js.ReflectiveInjector_._throwOrNull (core.es5.js:2649)
at ReflectiveInjector_.webpackJsonp.../../../core/@angular/co...
Run Code Online (Sandbox Code Playgroud)

登录组件加载良好,寄存器失败.

在登录组件html我有:

 <a [routerLink]="['/register']" class="btn btn-link">Register</a>
Run Code Online (Sandbox Code Playgroud)

我的应用程序路由如下所示:

 const appRoutes: Routes = [
{ path: '', component: HomeComponent, canActivate: [GuardService] },
{ path: 'login', component: LoginComponent },
{ path: 'register', component: RegisterComponent },

// otherwise redirect to home
{ path: '**', redirectTo: '' }
];

export const routing = RouterModule.forRoot(appRoutes);
Run Code Online (Sandbox Code Playgroud)

我正在使用的版本:Node.js版本:v8.5.0 NPM版本:5.4.2

谢谢!

angular angular-httpclient

2
推荐指数
1
解决办法
5809
查看次数