简体   繁体   English

Spring安全性登录点指向MySQL数据库和其他功能应使用SQL Server数据库

[英]Spring security login point to MySQL database and other functionality should use SQL Server database

In my project I want to make spring security login functionality to point to MySQL database and other functionality of my project is running in SQL server how can I make spring security login functionality to point to MySQL database. 在我的项目中,我想使Spring Security登录功能指向MySQL数据库,而我的项目的其他功能正在SQL Server中运行,如何使Spring Security登录功能指向MySQL数据库。

I created to data source namely : dataSource and dataSourceMySQL 我创建了数据源,即:dataSource和dataSourceMySQL

dataSource is pointing to SQL Server database and dataSourceMySQL is pointing to MySQL database. dataSource指向SQL Server数据库,dataSourceMySQL指向MySQL数据库。 But I don't know how to go further. 但是我不知道该怎么走。 How can I achieve "to make spring security login functionality to point to MySQL database"? 如何实现“使Spring Security登录功能指向MySQL数据库”?

in your spring security context you can use 在您的春季安全上下文中,您可以使用

authentication-manager 认证经理

with

authentication-provider 认证提供者

then with 然后用

jdbc-user-service jdbc用户服务

and set 并设置

data-source-ref 数据源参考

with you mysql datasource as in below: 与您的mysql数据源如下:

<security:authentication-manager alias="authenticationManager">
    <security:authentication-provider>
        <security:password-encoder hash="md5" />
        <security:jdbc-user-service id="jdbcUserService"
            data-source-ref="dataSource" />
    </security:authentication-provider>
</security:authentication-manager>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM