Spring boot 集成 beetlsql运行警告,但不影响使用
系统按照 http://git.oschina.net/xiandafu/springboot_beetl_beetlsql 示例搭建。
代码如下:
/** * Dao基类 <br/> */ public interface BaseDao<T> extends BaseMapper<T> {}
/** * 用户 <br/> */ public interface UserDao extends BaseDao<User> {}
@SpringBootApplication public class WebConfig extends WebMvcConfigurerAdapter { /** * beetlSql 扫描包. <br/> */ @Bean(name = "beetlSqlScannerConfigurer") public BeetlSqlScannerConfigurer getBeetlSqlScannerConfigurer() { BeetlSqlScannerConfigurer conf = new BeetlSqlScannerConfigurer(); conf.setBasePackage("com.test.dao"); conf.setDaoSuffix("Dao"); conf.setSqlManagerFactoryBeanName("sqlManagerFactoryBean"); return conf; } /** * * beetlSql 扫描SQL模版. <br/> */ @Bean(name = "sqlManagerFactoryBean") @Primary public SqlManagerFactoryBean getSqlManagerFactoryBean(@Qualifier("datasource") DataSource datasource) { SqlManagerFactoryBean factory = new SqlManagerFactoryBean(); BeetlSqlDataSource source = new BeetlSqlDataSource(); source.setMasterSource(datasource); factory.setCs(source); factory.setDbStyle(new MySqlStyle()); factory.setInterceptors(new Interceptor[] { new DebugInterceptor() }); factory.setNc(new UnderlinedNameConversion()); factory.setSqlLoader(new ClasspathLoader("/sql")); return factory; } }
server.port=8080 logging.config=classpath:log4j2.xml
# 语句的定界符号 DELIMITER_STATEMENT_START=@ DELIMITER_STATEMENT_END=null #是否检测文件变化,生产环境配置为false RESOURCE.autoCheck= true #自定义脚本方法文件的Root目录和后缀 RESOURCE.functionRoot = functions RESOURCE.functionSuffix = html #自定义标签文件Root目录和后缀 RESOURCE.tagRoot = htmltag RESOURCE.tagSuffix = html
2017-01-19 16:53:57,415 WARN o.s.b.f.s.AbstractBeanFactory [main] Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in file [E:workspacetesttargetclassescomtestdaoUserDao.class]: Cannot resolve reference to bean 'sqlManagerFactoryBean' while setting bean property 'sqlManager'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sqlManagerFactoryBean': Requested bean is currently in creation: Is there an unresolvable circular reference?
不知哪里错了?但不影响使用。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
不知道为什么,十分讨厌spring boot..
看着别扭,总觉得有问题。
升级springboot版本看看,应该是另外一个提示
回复
@闲大赋 : 1.4.3.RELEASE,最新版。
这是正常的,不影响使用