Closed uPagge closed 3 years ago
@uPagge thanks for the advice!
@shy1st I think we can add a constructor for datasource arg too like the jdbc-adapter: https://github.com/jcasbin/jdbc-adapter
@uPagge Excuse me, do you want this construction method?
Yes that would be great
@uPagge we are not very clear about how to implement sucha constructor, can you explain a little? Or even a PR would be great!
Unfortunately I'm not that good: D
But I know where it is possible to spy on. Liquibase uses this, but not in the constructor is true. Perhaps the sources of Liquibase will help you understand.
Sorry, we can get URL, driver and user name through datasource, but we can't get password. Can you provide password in the construction method? Or do you have any other ideas? @uPagge
@uPagge Maybe the ConnectionProvider can set the datasource, but how to build SessionFactory through ConnectionProvider is a problem.May I ask you what is your idea?
Well, my idea is that in the world of spring boot applications, database connection for libraries compatible with spring happens through this very datasource. Unfortunately, I do not know how to do this, and therefore I cannot tell. Just suggested an idea for improving convenience))
@fangzhengjin Excuse me, may I ask you your idea?
@uPagge Are you using casbin in the spring boot ?
@fangzhengjin Excuse me, may I ask you your idea?
I think we can set the data source through the hibernate.connection.datasource
configuration.
see: database-connectionprovider-datasource
@fangzhengjin Thank you for your advice!
@shy1st plz make a new release on both Maven and GitHub.
Adapter adapter = new HibernateAdapter(DRIVER, URL, USERNAME, PASSWORD, true);
Why not make the constructor accept a Datasource?