NutzCN Logo
问答 我的写法是否可以修复1.r.61启动加载sql数量为0的解决方案?
发布于 225天前 作者 wx_nlugjssocpkj3bf8bamd 266 次浏览 复制 上一个帖子 下一个帖子
标签:
<dependency>
      <groupId>org.nutz</groupId>
      <artifactId>nutz</artifactId>
      <version>1.r.61</version>
    </dependency>

    <dependency>
      <groupId>org.nutz</groupId>
      <artifactId>nutz-integration-spring</artifactId>
      <version>1.r.61.r2</version>
    </dependency>
    @Autowired
    private Dao dao;

   @Bean
    public GfMap<String,String> loadExpressCompanyCode(){
            /**修复因Nutz版本问题可能导致sqls加载异常的问题*/
            int sqlCount = dao.sqls().count();
            System.out.println("[SqlManager Sql count : " + sqlCount + " ]");
    }
15 回复

最好是系统启动的时候执行一下

额,抱歉,还是有点没理解在哪里使用会比较好一些,不是放在Bean里吗?

还是在下面的代码里用呢?请@wendal明示。

    @Autowired
    public void setFileSqlManager() {
        FileSqlManager fileSqlManager = new FileSqlManager("/sqls/");
        setSqlManager(fileSqlManager);
    }

可以的,setSqlManager之后就调用一次count

好的,谢谢@wendal指点。

您看如下我写的可以吗?

@Autowired
    public void setFileSqlManager() {
        FileSqlManager fileSqlManager = new FileSqlManager("/sqls/");
        setSqlManager(fileSqlManager);

        /**修复因Nutz版本问题可能导致sqls加载异常的问题*/
        int sqlCount = this.sqls().count();
        System.out.println("[SqlManager Sql count : " + sqlCount + " ]");
    }

@wendal 按上面的说法加上之后,我在测试后,还是会出现错误
错误如下
请问,如果在不升级nutz包的情况下,还有什么其他办法修复这个BUG吗?
或者是我count的方式不对?

Listening for transport dt_socket at address: 5005
11:04:04.456 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
11:04:04.465 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
11:04:04.467 [main] DEBUG org.springframework.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.6.RELEASE)

2019-05-06 11:04:05.259  INFO 2380 --- [           main] cn.guanfu.GuanfuAppServer                : Starting GuanfuAppServer v1.0 on bogon with PID 2380 (/home/jarDir/GuanfuAppServer-1.0.jar started by root in /home/jarDir)
2019-05-06 11:04:05.260  INFO 2380 --- [           main] cn.guanfu.GuanfuAppServer                : The following profiles are active: pkgen,dev
2019-05-06 11:04:05.304  INFO 2380 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@742ff096: startup date [Mon May 06 11:04:05 CST 2019]; root of context hierarchy
2019-05-06 11:04:07.381  INFO 2380 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'managementServletContext' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcHypermediaManagementContextConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.class]]
2019-05-06 11:04:07.414  INFO 2380 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2019-05-06 11:04:08.312  INFO 2380 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'redisCacheConfig' of type [cn.guanfu.config.RedisCacheConfig$$EnhancerBySpringCGLIB$$87f5fc8f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-06 11:04:08.421  INFO 2380 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cache.annotation.ProxyCachingConfiguration' of type [org.springframework.cache.annotation.ProxyCachingConfiguration$$EnhancerBySpringCGLIB$$bdf676f4] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-06 11:04:08.708  INFO 2380 --- [           main] org.xnio                                 : XNIO version 3.3.8.Final
2019-05-06 11:04:08.728  INFO 2380 --- [           main] org.xnio.nio                             : XNIO NIO Implementation Version 3.3.8.Final
2019-05-06 11:04:08.806  WARN 2380 --- [           main] io.undertow.websockets.jsr               : UT026009: XNIO worker was not set on WebSocketDeploymentInfo, the default worker will be used
2019-05-06 11:04:08.807  WARN 2380 --- [           main] io.undertow.websockets.jsr               : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2019-05-06 11:04:08.833  INFO 2380 --- [           main] io.undertow.servlet                      : Initializing Spring embedded WebApplicationContext
2019-05-06 11:04:08.833  INFO 2380 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3532 ms
2019-05-06 11:04:09.096  INFO 2380 --- [           main] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2019-05-06 11:04:09.100  INFO 2380 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'metricsFilter' to: [/*]
2019-05-06 11:04:09.101  INFO 2380 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-05-06 11:04:09.101  INFO 2380 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-05-06 11:04:09.102  INFO 2380 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2019-05-06 11:04:09.102  INFO 2380 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2019-05-06 11:04:09.102  INFO 2380 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2019-05-06 11:04:09.102  INFO 2380 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'applicationContextIdFilter' to: [/*]
2019-05-06 11:04:09.295  WARN 2380 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation should only be used on methods with parameters: public void cn.guanfu.common.db.GFDao.setFileSqlManager()
2019-05-06 11:04:09.424 DEBUG 2380 --- [           main] org.nutz.dao.impl.FileSqlManager         : load >> /sqls/ from root=/sqls/
2019-05-06 11:04:09.429 DEBUG 2380 --- [           main] org.nutz.dao.impl.FileSqlManager         : load 0 sql >> /sqls/ from root=/sqls/
2019-05-06 11:04:09.429 DEBUG 2380 --- [           main] org.nutz.dao.impl.DaoSupport             : SqlManager Sql count=0
[SqlManager Sql count : 0 ]
2019-05-06 11:04:09.622  INFO 2380 --- [           main] org.nutz.filepool.NutFilePool            : Init file-pool by: /root/.nutz/tmp/dao/ [200000]
2019-05-06 11:04:09.623  INFO 2380 --- [           main] org.nutz.filepool.NutFilePool            : file-pool.cursor: 0
2019-05-06 11:04:09.699 DEBUG 2380 --- [           main] org.nutz.dao.jdbc.Jdbcs                  : Jdbcs init complete
2019-05-06 11:04:09.700  INFO 2380 --- [           main] org.nutz.dao.jdbc.Jdbcs                  : Get Connection from DataSource for JdbcExpert, if you lock at here, check your database server and configure
2019-05-06 11:04:09.702  INFO 2380 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2019-05-06 11:04:09.941  INFO 2380 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2019-05-06 11:04:09.949 DEBUG 2380 --- [           main] org.nutz.dao.impl.DaoSupport             : select expert : org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert
2019-05-06 11:04:09.955 DEBUG 2380 --- [           main] org.nutz.dao.impl.DaoSupport             : JDBC Driver --> mysql-connector-java-5.1.43 ( Revision: 1d14b699eff3e6112aaedb1cbe5a151ab81f98f1 )
2019-05-06 11:04:09.955 DEBUG 2380 --- [           main] org.nutz.dao.impl.DaoSupport             : JDBC Name   --> MySQL Connector Java
2019-05-06 11:04:09.955 DEBUG 2380 --- [           main] org.nutz.dao.impl.DaoSupport             : JDBC URL    --> jdbc:mysql://10.0.0.254/gf-010060-3?useSSL=false
2019-05-06 11:04:09.963 DEBUG 2380 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_client=utf8mb4
2019-05-06 11:04:09.963 DEBUG 2380 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_connection=utf8mb4
2019-05-06 11:04:09.963 DEBUG 2380 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_database=utf8mb4
2019-05-06 11:04:09.964 DEBUG 2380 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_filesystem=binary
2019-05-06 11:04:09.964 DEBUG 2380 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_results=
2019-05-06 11:04:09.964 DEBUG 2380 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_server=utf8mb4
2019-05-06 11:04:09.964 DEBUG 2380 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_system=utf8
2019-05-06 11:04:09.964 DEBUG 2380 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_sets_dir=/usr/local/mysql/share/charsets/
2019-05-06 11:04:09.965 DEBUG 2380 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : binlog_format=MIXED
2019-05-06 11:04:09.966 DEBUG 2380 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : database=gf-010060-3
2019-05-06 11:04:09.966 DEBUG 2380 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : user=root@bogon
2019-05-06 11:04:09.979 DEBUG 2380 --- [           main] org.nutz.dao.impl.DaoSupport             : Database info --> MYSQL:[MySQL - 5.7.22-log]
2019-05-06 11:04:11.351  INFO 2380 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService  'taskExecutor'


org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.nutz.dao.SqlNotFoundException: fail to find SQL 'ad.selectAds'! at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129) at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:110) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:106) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:326) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:812) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: org.nutz.dao.SqlNotFoundException: fail to find SQL 'ad.selectAds'! at org.nutz.dao.impl.FileSqlManager.get(FileSqlManager.java:130) at org.nutz.dao.impl.FileSqlManager.create(FileSqlManager.java:135) at cn.guanfu.common.db.GFDao.getPageList(GFDao.java:148) at cn.guanfu.common.db.GFDao.getList(GFDao.java:134) at cn.guanfu.common.db.GFDao$$FastClassBySpringCGLIB$$4e8fec05.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673) at cn.guanfu.common.db.GFDao$$EnhancerBySpringCGLIB$$de286127.getList(<generated>) at cn.guanfu.controller.AdController.random(AdController.java:45) 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:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ... 61 common frames omitted
load >> /sqls/ from root=/sqls/
2019-05-06 11:04:09.429 DEBUG 2380 --- [           main] org.nutz.dao.impl.FileSqlManager         : load 0 sql >> /sqls/ from root=/sqls/
2019-05-06 11:04:09.429 DEBUG 2380 --- [           main] org.nutz.dao.impl.DaoSupport             : SqlManager Sql count=0

一个文件都没找到,sqls目录放哪里了?src/main/resources/sqls/ 吗?

改成 sqls/ 试试

是的,放在 src/main/resources/sqls/中了。
那我配置时改成sqls/试试。

@wendal 如下,改成sqls/的话,也还是报上面的问题

Listening for transport dt_socket at address: 5005
11:49:22.134 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding [systemProperties] PropertySource with lowest search precedence
11:49:22.144 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence
11:49:22.146 [main] DEBUG org.springframework.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.6.RELEASE)

2019-05-06 11:49:22.943  INFO 9086 --- [           main] cn.guanfu.GuanfuAppServer                : Starting GuanfuAppServer v1.0 on bogon with PID 9086 (/home/jarDir/GuanfuAppServer-1.0.jar started by root in /home/jarDir)
2019-05-06 11:49:22.944  INFO 9086 --- [           main] cn.guanfu.GuanfuAppServer                : The following profiles are active: pkgen,dev
2019-05-06 11:49:23.018  INFO 9086 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@712625fd: startup date [Mon May 06 11:49:23 CST 2019]; root of context hierarchy
2019-05-06 11:49:25.015  INFO 9086 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'managementServletContext' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcHypermediaManagementContextConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.class]]
2019-05-06 11:49:25.048  INFO 9086 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2019-05-06 11:49:25.919  INFO 9086 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'redisCacheConfig' of type [cn.guanfu.config.RedisCacheConfig$$EnhancerBySpringCGLIB$$3cb857bb] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-06 11:49:26.017  INFO 9086 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cache.annotation.ProxyCachingConfiguration' of type [org.springframework.cache.annotation.ProxyCachingConfiguration$$EnhancerBySpringCGLIB$$72b8d220] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-06 11:49:26.341  INFO 9086 --- [           main] org.xnio                                 : XNIO version 3.3.8.Final
2019-05-06 11:49:26.360  INFO 9086 --- [           main] org.xnio.nio                             : XNIO NIO Implementation Version 3.3.8.Final
2019-05-06 11:49:26.435  WARN 9086 --- [           main] io.undertow.websockets.jsr               : UT026009: XNIO worker was not set on WebSocketDeploymentInfo, the default worker will be used
2019-05-06 11:49:26.435  WARN 9086 --- [           main] io.undertow.websockets.jsr               : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2019-05-06 11:49:26.465  INFO 9086 --- [           main] io.undertow.servlet                      : Initializing Spring embedded WebApplicationContext
2019-05-06 11:49:26.465  INFO 9086 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3449 ms
2019-05-06 11:49:26.789  INFO 9086 --- [           main] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2019-05-06 11:49:26.886  INFO 9086 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'metricsFilter' to: [/*]
2019-05-06 11:49:26.887  INFO 9086 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-05-06 11:49:26.887  INFO 9086 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-05-06 11:49:26.887  INFO 9086 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2019-05-06 11:49:26.887  INFO 9086 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2019-05-06 11:49:26.888  INFO 9086 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2019-05-06 11:49:26.888  INFO 9086 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'applicationContextIdFilter' to: [/*]
2019-05-06 11:49:26.969  WARN 9086 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation should only be used on methods with parameters: public void cn.guanfu.common.db.GFDao.setFileSqlManager()
2019-05-06 11:49:27.099 DEBUG 9086 --- [           main] org.nutz.dao.impl.FileSqlManager         : load >> sqls/ from root=sqls/
2019-05-06 11:49:27.104 DEBUG 9086 --- [           main] org.nutz.dao.impl.FileSqlManager         : load 0 sql >> sqls/ from root=sqls/
2019-05-06 11:49:27.104 DEBUG 9086 --- [           main] org.nutz.dao.impl.DaoSupport             : SqlManager Sql count=0
------------------------------------------重设sqlManager------------------------------------------
2019-05-06 11:49:27.119 DEBUG 9086 --- [           main] org.nutz.dao.impl.FileSqlManager         : load >> /sqls/ from root=/sqls/
2019-05-06 11:49:27.119 DEBUG 9086 --- [           main] org.nutz.dao.impl.FileSqlManager         : load 0 sql >> /sqls/ from root=/sqls/
2019-05-06 11:49:27.120 DEBUG 9086 --- [           main] org.nutz.dao.impl.DaoSupport             : SqlManager Sql count=0
2019-05-06 11:49:27.469  INFO 9086 --- [           main] org.nutz.filepool.NutFilePool            : Init file-pool by: /root/.nutz/tmp/dao/ [200000]
2019-05-06 11:49:27.470  INFO 9086 --- [           main] org.nutz.filepool.NutFilePool            : file-pool.cursor: 0
2019-05-06 11:49:27.612 DEBUG 9086 --- [           main] org.nutz.dao.jdbc.Jdbcs                  : Jdbcs init complete
2019-05-06 11:49:27.612  INFO 9086 --- [           main] org.nutz.dao.jdbc.Jdbcs                  : Get Connection from DataSource for JdbcExpert, if you lock at here, check your database server and configure
2019-05-06 11:49:27.615  INFO 9086 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2019-05-06 11:49:27.881  INFO 9086 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2019-05-06 11:49:27.888 DEBUG 9086 --- [           main] org.nutz.dao.impl.DaoSupport             : select expert : org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert
2019-05-06 11:49:27.895 DEBUG 9086 --- [           main] org.nutz.dao.impl.DaoSupport             : JDBC Driver --> mysql-connector-java-5.1.43 ( Revision: 1d14b699eff3e6112aaedb1cbe5a151ab81f98f1 )
2019-05-06 11:49:27.895 DEBUG 9086 --- [           main] org.nutz.dao.impl.DaoSupport             : JDBC Name   --> MySQL Connector Java
2019-05-06 11:49:27.896 DEBUG 9086 --- [           main] org.nutz.dao.impl.DaoSupport             : JDBC URL    --> jdbc:mysql://10.0.0.254/gf-010060-3?useSSL=false
2019-05-06 11:49:27.904 DEBUG 9086 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_client=utf8mb4
2019-05-06 11:49:27.904 DEBUG 9086 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_connection=utf8mb4
2019-05-06 11:49:27.904 DEBUG 9086 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_database=utf8mb4
2019-05-06 11:49:27.904 DEBUG 9086 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_filesystem=binary
2019-05-06 11:49:27.904 DEBUG 9086 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_results=
2019-05-06 11:49:27.905 DEBUG 9086 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_server=utf8mb4
2019-05-06 11:49:27.905 DEBUG 9086 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_system=utf8
2019-05-06 11:49:27.905 DEBUG 9086 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_sets_dir=/usr/local/mysql/share/charsets/
2019-05-06 11:49:27.906 DEBUG 9086 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : binlog_format=MIXED
2019-05-06 11:49:27.907 DEBUG 9086 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : database=gf-010060-3
2019-05-06 11:49:27.907 DEBUG 9086 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : user=root@bogon
2019-05-06 11:49:27.921 DEBUG 9086 --- [           main] org.nutz.dao.impl.DaoSupport             : Database info --> MYSQL:[MySQL - 5.7.22-log]
2019-05-06 11:49:30.048  INFO 9086 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService  'taskExecutor'

package cn.guanfu.common.db;

import cn.guanfu.common.utils.Utils;
import cn.guanfu.config.PkGenConfig;
import cn.guanfu.entity.SysIdWorkerEntity;
import cn.guanfu.service.SystemService;
import com.relops.snowflake.Snowflake;
import org.nutz.conf.NutConf;
import cn.guanfu.common.constants.Const;
import cn.guanfu.common.generator.FireIdGenerator;

import org.nutz.dao.Cnd;
import org.nutz.dao.SqlManager;
import org.nutz.dao.Sqls;
import org.nutz.dao.impl.FileSqlManager;
import org.nutz.dao.impl.NutDao;
import org.nutz.dao.pager.Pager;
import org.nutz.dao.sql.Sql;
import org.nutz.el.opt.custom.CustomMake;
import org.nutz.integration.spring.SpringResourceLoaction;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.resource.NutResource;
import org.nutz.resource.Scans;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import javax.sql.DataSource;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by firenut on 16/11/17.
 */
@SuppressWarnings("SpringJavaAutowiringInspection")
@Configuration
@Repository("dao")
@Order(3)
public class GFDao extends NutDao {

//    @Autowired
//    private PKGenerator pkGenerator;

    @Autowired
    private FireIdGenerator fireIdGenerator;

    @Autowired
    private PkGenConfig pkGenConfig;

    private DataSource hikariDataSource;

    private Integer node;

    private FileSqlManager fileSqlManager;


    @Autowired
    public void setHikariDataSource(DataSource hikariDataSource) {
        this.hikariDataSource = hikariDataSource;

        SpringResourceLoaction springResourceLoaction = new SpringResourceLoaction();
        springResourceLoaction.setApplicationContext(applicationContext);
        Scans.me().addResourceLocation(springResourceLoaction);



        setDataSource(hikariDataSource);
    }


    @Autowired
    private ApplicationContext applicationContext;




    @Autowired(required = false)
    public void setFileSqlManager() {
        FileSqlManager fileSqlManager = new FileSqlManager("sqls/");
        setSqlManager(fileSqlManager);

        /**修复因Nutz版本问题可能导致sqls加载异常的问题*/
        int sqlCount = this.sqls().count();
        if (0==sqlCount){
            System.out.println("------------------------------------------" +
                    "重设sqlManager" +
                    "------------------------------------------");
            setSqlManager(new FileSqlManager("/sqls/"));
        }else {
            System.out.println("[SqlManager Sql count : " + sqlCount + " ]");
        }
    }

}

addResourceLocation是先执行还是后执行了?

稍等,我确认下正常情况下和异常情况下addResourceLocation的执行顺序。

@wendal 出错时如下:(先setFileSqlManager后addResourceLocation)

Listening for transport dt_socket at address: 5005                                                                                                                           
13:11:51.017 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding [systemProperties] PropertySource with lowest search precedence                          
13:11:51.027 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding [systemEnvironment] PropertySource with lowest search precedence                         
13:11:51.029 [main] DEBUG org.springframework.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment]       
                                                                                                                                                                             
  .   ____          _            __ _ _                                                                                                                                      
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \                                                                                                                                     
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \                                                                                                                                    
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )                                                                                                                                   
  '  |____| .__|_| |_|_| |_\__, | / / / /                                                                                                                                    
 =========|_|==============|___/=/_/_/_/                                                                                                                                     
 :: Spring Boot ::        (v1.5.6.RELEASE)                                                                                                                                   
                                                                                                                                                                             
2019-05-06 13:11:51.818  INFO 20508 --- [           main] cn.guanfu.GuanfuAppServer                : Starting GuanfuAppServer v1.0 on bogon with PID 20508 (/home/jarDir/GuanfuAppServer-1.0.jar started by root in /home/jarDir)                                                                                                                         
2019-05-06 13:11:51.819  INFO 20508 --- [           main] cn.guanfu.GuanfuAppServer                : The following profiles are active: pkgen,dev                            
2019-05-06 13:11:51.868  INFO 20508 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@17f9d882: startup date [Mon May 06 13:11:51 CST 2019]; root of context hierarchy                                                                  
2019-05-06 13:11:53.927  INFO 20508 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'managementServletContext' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcHypermediaManagementContextConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.class]]                                                          
2019-05-06 13:11:53.957  INFO 20508 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!                                                                                                                                                                   
2019-05-06 13:11:54.770  INFO 20508 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'redisCacheConfig' of type [cn.guanfu.config.RedisCacheConfig$$EnhancerBySpringCGLIB$$a2ca58ad] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)                                   
2019-05-06 13:11:54.859  INFO 20508 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cache.annotation.ProxyCachingConfiguration' of type [org.springframework.cache.annotation.ProxyCachingConfiguration$$EnhancerBySpringCGLIB$$d8cad312] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)                                                                                                                                     
2019-05-06 13:11:55.165  INFO 20508 --- [           main] org.xnio                                 : XNIO version 3.3.8.Final                                                
2019-05-06 13:11:55.183  INFO 20508 --- [           main] org.xnio.nio                             : XNIO NIO Implementation Version 3.3.8.Final                             
2019-05-06 13:11:55.257  WARN 20508 --- [           main] io.undertow.websockets.jsr               : UT026009: XNIO worker was not set on WebSocketDeploymentInfo, the default worker will be used                                                                                                                                                        
2019-05-06 13:11:55.257  WARN 20508 --- [           main] io.undertow.websockets.jsr               : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used                                                                                                                                                          
2019-05-06 13:11:55.284  INFO 20508 --- [           main] io.undertow.servlet                      : Initializing Spring embedded WebApplicationContext                      
2019-05-06 13:11:55.284  INFO 20508 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3418 ms         
2019-05-06 13:11:55.641  INFO 20508 --- [           main] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]                             
2019-05-06 13:11:55.646  INFO 20508 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'metricsFilter' to: [/*]                                
2019-05-06 13:11:55.647  INFO 20508 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]                      
2019-05-06 13:11:55.647  INFO 20508 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]                       
2019-05-06 13:11:55.647  INFO 20508 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]                     
2019-05-06 13:11:55.647  INFO 20508 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]                         
2019-05-06 13:11:55.647  INFO 20508 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webRequestLoggingFilter' to: [/*]                      
2019-05-06 13:11:55.647  INFO 20508 --- [           main] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'applicationContextIdFilter' to: [/*]                   
2019-05-06 13:11:55.727  WARN 20508 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation should only be used on methods with parameters: public void cn.guanfu.common.db.GFDao.setFileSqlManager()                                                                                                                       
2019-05-06 13:11:55.832 DEBUG 20508 --- [           main] org.nutz.dao.impl.FileSqlManager         : load >> sqls/ from root=sqls/                                           
2019-05-06 13:11:55.837 DEBUG 20508 --- [           main] org.nutz.dao.impl.FileSqlManager         : load 0 sql >> sqls/ from root=sqls/                                     
2019-05-06 13:11:55.837 DEBUG 20508 --- [           main] org.nutz.dao.impl.DaoSupport             : SqlManager Sql count=0                                                  
------------------------------------------重设sqlManager------------------------------------------                                                                           
2019-05-06 13:11:55.852 DEBUG 20508 --- [           main] org.nutz.dao.impl.FileSqlManager         : load >> /sqls/ from root=/sqls/                                         
2019-05-06 13:11:55.852 DEBUG 20508 --- [           main] org.nutz.dao.impl.FileSqlManager         : load 0 sql >> /sqls/ from root=/sqls/                                   
2019-05-06 13:11:55.852 DEBUG 20508 --- [           main] org.nutz.dao.impl.DaoSupport             : SqlManager Sql count=0                                                  
------------------------------------------setFileSqlManager------------------------------------------                                                                        
2019-05-06 13:11:56.149  INFO 20508 --- [           main] org.nutz.filepool.NutFilePool            : Init file-pool by: /root/.nutz/tmp/dao/ [200000]                        
2019-05-06 13:11:56.150  INFO 20508 --- [           main] org.nutz.filepool.NutFilePool            : file-pool.cursor: 0                                                     
2019-05-06 13:11:56.286 DEBUG 20508 --- [           main] org.nutz.dao.jdbc.Jdbcs                  : Jdbcs init complete                                                     
2019-05-06 13:11:56.286  INFO 20508 --- [           main] org.nutz.dao.jdbc.Jdbcs                  : Get Connection from DataSource for JdbcExpert, if you lock at here, check your database server and configure                                                                                                                                         
2019-05-06 13:11:56.289  INFO 20508 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...                                              
2019-05-06 13:11:56.554  INFO 20508 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.                                         
2019-05-06 13:11:56.561 DEBUG 20508 --- [           main] org.nutz.dao.impl.DaoSupport             : select expert : org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert            
2019-05-06 13:11:56.568 DEBUG 20508 --- [           main] org.nutz.dao.impl.DaoSupport             : JDBC Driver --> mysql-connector-java-5.1.43 ( Revision: 1d14b699eff3e6112aaedb1cbe5a151ab81f98f1 )
2019-05-06 13:11:56.568 DEBUG 20508 --- [           main] org.nutz.dao.impl.DaoSupport             : JDBC Name   --> MySQL Connector Java
2019-05-06 13:11:56.568 DEBUG 20508 --- [           main] org.nutz.dao.impl.DaoSupport             : JDBC URL    --> jdbc:mysql://10.0.0.254/gf-010060-3?useSSL=false
2019-05-06 13:11:56.576 DEBUG 20508 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_client=utf8mb4
2019-05-06 13:11:56.576 DEBUG 20508 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_connection=utf8mb4
2019-05-06 13:11:56.576 DEBUG 20508 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_database=utf8mb4
2019-05-06 13:11:56.576 DEBUG 20508 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_filesystem=binary
2019-05-06 13:11:56.576 DEBUG 20508 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_results=
2019-05-06 13:11:56.576 DEBUG 20508 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_server=utf8mb4
2019-05-06 13:11:56.576 DEBUG 20508 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_system=utf8
2019-05-06 13:11:56.576 DEBUG 20508 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_sets_dir=/usr/local/mysql/share/charsets/
2019-05-06 13:11:56.578 DEBUG 20508 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : binlog_format=MIXED
2019-05-06 13:11:56.578 DEBUG 20508 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : database=gf-010060-3
2019-05-06 13:11:56.578 DEBUG 20508 --- [           main] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : user=root@bogon
2019-05-06 13:11:56.592 DEBUG 20508 --- [           main] org.nutz.dao.impl.DaoSupport             : Database info --> MYSQL:[MySQL - 5.7.22-log]
------------------------------------------addResourceLocation------------------------------------------
2019-05-06 13:11:58.658  INFO 20508 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService  'taskExecutor'

正常加载如下:
在org.nutz.dao.impl.DaoSupport之后addResourceLocation
然后才setFileSqlManager

抽出来,两个方法都调用,并确保只执行一次(标识符之类的)

好的,我抽出来之后再试试~谢谢 @wendal

添加回复
请先登陆
回到顶部