Dao 配置
@Configuration
@Repository("dao")
public class GFDao extends NutDao {
@Autowired
private FireIdGenerator fireIdGenerator;
private DataSource hikariDataSource;
private FileSqlManager fileSqlManager;
@PostConstruct
public void reg(){
CustomMake.me().register(Const.ID_GEN_DEF, fireIdGenerator);
}
@Autowired
public void setHikariDataSource(DataSource hikariDataSource) {
this.hikariDataSource = hikariDataSource;
setDataSource(hikariDataSource);
}
@Autowired
private ApplicationContext applicationContext;
@Autowired
public void setFileSqlManager() {
try {
SpringResourceLoaction springResourceLoaction = new SpringResourceLoaction();
springResourceLoaction.setApplicationContext(applicationContext);
Scans.me().addResourceLocation(springResourceLoaction);
setSqlManager(new FileSqlManager("sqls"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
异常信息
2017-05-09 12:58:31.220 DEBUG 76723 --- [ main] org.nutz.dao.impl.FileSqlManager : load >> sqls from root=sqls
2017-05-09 12:58:31.221 DEBUG 76723 --- [ main] org.nutz.dao.impl.FileSqlManager : load 0 sql >> sqls from root=sqls
2017-05-09 12:58:31.221 DEBUG 76723 --- [ main] org.nutz.dao.impl.DaoSupport : SqlManager Sql count=0
2017-05-09 12:58:31.372 WARN 76723 --- [ main] org.nutz.conf.NutConf : Fail to load config?! for NutzDefaultConfig.js
java.lang.RuntimeException: java.io.FileNotFoundException: file:/Users/firenut/project/gf/gfapp-2-0-api/target/gfAppServer-1.0.jar!/BOOT-INF/lib/nutz-1.r.61.jar!/org/nutz/conf/NutzDefaultConfig.js
at org.nutz.lang.Lang.wrapThrow(Lang.java:184)
at org.nutz.lang.Streams.fileIn(Streams.java:509)
at org.nutz.resource.impl.FileResource.getInputStream(FileResource.java:49)
at org.nutz.resource.NutResource.getReader(NutResource.java:41)
at org.nutz.conf.NutConf.loadResource(NutConf.java:88)
at org.nutz.conf.NutConf.<init>(NutConf.java:63)
at org.nutz.conf.NutConf.me(NutConf.java:55)
at org.nutz.conf.NutConf.get(NutConf.java:120)
at org.nutz.el.opt.custom.CustomMake.init(CustomMake.java:36)
at org.nutz.el.opt.custom.CustomMake.<clinit>(CustomMake.java:28)
at cn.gf.common.db.GFDao.reg(GFDao.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:366)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:311)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:134)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1620)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at cn.gf.gfAppServer.main(gfAppServer.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.io.FileNotFoundException: file:/Users/firenut/project/gf/gfapp-2-0-api/target/gfAppServer-1.0.jar!/BOOT-INF/lib/nutz-1.r.61.jar!/org/nutz/conf/NutzDefaultConfig.js
at org.nutz.lang.Streams._input(Streams.java:680)
at org.nutz.lang.Streams.fileIn(Streams.java:506)
... 40 common frames omitted