We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2020-11-14 17:11:09.963 WARN 7360 --- [nio-8080-exec-6] .m.m.a.ExceptionHandlerExceptionResolver : Resolved exception caused by Handler execution: java.lang.IllegalStateException: The connectionFactory cannot be null 这个错啥意思?不懂了
The text was updated successfully, but these errors were encountered:
1)首先提问题要仔细,日志信息需要以代码的形式包裹前后用 "```" 包裹, 2)“ The connectionFactory cannot be null” 你可以参考:http://www.objsql.com/docs/basic/demo-source/ 这里的说明
完整的代码参考:Application.java
private class ApplicationConnectionFactory implements ConnectionFactory { private final ApplicationContext applicationContext; public ApplicationConnectionFactory(ApplicationContext applicationContext) { this.applicationContext = applicationContext; } @Override public Connection getConnection(String dataSourceName) throws SQLException { DataSource dataSource = (DataSource) applicationContext.getBean(dataSourceName); return dataSource.getConnection(); } }
@Bean(name = ConnectionFactory.DEFAULT_DATA_SOURCE_NAME) @ConfigurationProperties("spring.objsql-datasource.objsql-default-datasource") public DataSource getDataSource(){ return DataSourceBuilder.create().build(); } @EventListener public void onApplicationEvent(ApplicationStartedEvent event) { ConnectionFactory connectionFactory = new ApplicationConnectionFactory(event.getApplicationContext()); SQLExecutor sqlExecutor = new CacheableSQLExecutor(); LoggerFactory loggerFactory = new ObjLoggerFactoryImpl(); Databases.installConnectionFactory(connectionFactory); Databases.installSqlExecutor(sqlExecutor); Databases.installLoggerFactory(loggerFactory); }
Sorry, something went wrong.
ObjectiveSQL 全局注入你可以参考一下Databases.java 和Tables.java
如果已经修复了,请关闭issue ,如果还有疑问请回复。
我应该扩展一下SpringBoot, 实现AutoConfiguration,过两天会1.3.8 版本,会修复该问题。
catchex
No branches or pull requests
2020-11-14 17:11:09.963 WARN 7360 --- [nio-8080-exec-6] .m.m.a.ExceptionHandlerExceptionResolver : Resolved exception caused by Handler execution: java.lang.IllegalStateException: The connectionFactory cannot be null
这个错啥意思?不懂了
The text was updated successfully, but these errors were encountered: