springboot+mybatis+mysql+tomcat jdbc数据源 连接卡死 2C

如题配置,当系统运行后,第一次数据库请求没有问题,当5分钟不操作后,再次请求数据库,连接会卡死。重启软件后,又重复以上问题。急!急!急!

1个回答

数据库是不是本地的?如果不是考虑一下网络问题,或者贴上你的代码看看

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
springboot+mybatis+mysql+tomcat jdbc数据源 连接卡死

如题配置,当系统运行后,第一次数据库请求没有问题,当5分钟不操作后,再次请求数据库,连接会卡死。重启软件后,又重复以上问题。急!急!急!

springboot+mybatis切换数据源问题

# 问题描述 springboot+mybatis想实现oracle和Mysql数据库切换,目前用 Mysql作为 主数据源时, 可以正常查询;用Oracle作为主数据源时,也可以正常查询;目前想实现,Mysql作为主数据源时,也可以切换到另外一个数据源。 # 相关代码如下 ## 创建数据源 ### 创建Mysql数据源 ``` @Bean(name = "dataSource") @Primary public ComboPooledDataSource createDataSource() throws PropertyVetoException { ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource(); comboPooledDataSource.setDriverClass(jdbcDriver); comboPooledDataSource.setJdbcUrl(jdbcUrl); comboPooledDataSource.setUser(jdbcUsername); comboPooledDataSource.setPassword(jdbcPassword); //连接关闭不自动提交 comboPooledDataSource.setAutoCommitOnClose(false); return comboPooledDataSource; } @Bean(name="sqlSessionFactory") @Primary public SqlSessionFactoryBean createSqlSessionFactoryBean(@Qualifier("dataSource") DataSource dataSource) throws IOException { SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean(); sqlSessionFactoryBean.setConfigLocation(new ClassPathResource(mybatisConfigFilePath)); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); String packageSearchPath = PathMatchingResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + mapperPath; sqlSessionFactoryBean.setMapperLocations(resolver.getResources(packageSearchPath)); sqlSessionFactoryBean.setDataSource(dataSource); sqlSessionFactoryBean.setTypeAliasesPackage(entityPackage); return sqlSessionFactoryBean; } ``` ### 创建oracle数据源 ``` @Bean(name="oracleDataSource") public ComboPooledDataSource createOracleDataSource() throws PropertyVetoException { ComboPooledDataSource comboPooledOracleDataSource = new ComboPooledDataSource(); comboPooledOracleDataSource.setDriverClass(oracleJdbcDriver); comboPooledOracleDataSource.setJdbcUrl(oracleJdbcUrl); comboPooledOracleDataSource.setUser(oracleJdbcUser); comboPooledOracleDataSource.setPassword(oracleJdbcPassword); comboPooledOracleDataSource.setAutoCommitOnClose(false); return comboPooledOracleDataSource; } @Bean(name="oracleSqlSessionFactory") public SqlSessionFactoryBean createSqlSessionFactoryBean(@Qualifier("oracleDataSource") DataSource oracleDataSource) throws IOException { SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean(); sqlSessionFactoryBean.setConfigLocation(new ClassPathResource(mybatisConfigFilePath)); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); String packageSearchPath = PathMatchingResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + oracleMapperPath; sqlSessionFactoryBean.setMapperLocations(resolver.getResources(packageSearchPath)); sqlSessionFactoryBean.setDataSource(oracleDataSource); sqlSessionFactoryBean.setTypeAliasesPackage(entityPackage); return sqlSessionFactoryBean; } ``` ## 事物管理代码段 ``` @Autowired @Qualifier("dataSource") private DataSource dataSource; @Autowired @Qualifier("oracleDataSource") private DataSource oracleDataSource; @Bean(name="localMysql") public PlatformTransactionManager localMysqlManager(){ return new DataSourceTransactionManager(dataSource); } @Bean(name="localOracle") public PlatformTransactionManager oracleManager(){ return new DataSourceTransactionManager(oracleDataSource); } ``` ## 切换数据源代码段 ``` @Override @Transactional(value = "localOracle") public List<Map> listOracle() { return helloOracleDao.listHello(); } ``` # 问题 感觉数据源创建什么的都没问题,但是最后一步切换不生效,不知道什么问题,还请大神赐教

springboot + mybatis 怎么配置多数据源

要完整一点的 从service层开始 而不是直接从controller层直接跳到mapper

springboot + mybatis 多数据源问题

项目已经上线了,现在修改为多数据源模式 现在遇到的问题是,设置默认数据源不生效,一直用第一个,也不知道它是根据什么来选择哪个是默认数据源的 ![图片说明](https://img-ask.csdn.net/upload/201805/31/1527743096_468533.png)

springboot+mybatis+数据库连接池+mysql

**求助** 我这边有一个springboot的应用,通过浏览器请求后台服务,后台服务通过mybatis查询数据库的数据(数据库服务关闭),由于数据库连接不上连接池会报数据库无法连接,并且重复尝试连接,此时后台服务请求的无法捕获到数据库无法连接的异常整个线程一直处于等待状态,不知道该怎么捕获异常,这个请求资源能够正常释放?

springboot mybatis 整合后怎么答应输出sql语句

关于springboot mybatis 整合后,我想看到mybatis的sql语句日志输出,贴出我的Application.java代码 @SpringBootApplication //等价于@ComponentScan+@EnableAutoConfiguration+@Configuration @MapperScan("cn.no7player.mapper") public class Application { private static Logger logger = Logger.getLogger(Application.class); @Bean @ConfigurationProperties(prefix="spring.datasource") public DataSource dataSource() { return new org.apache.tomcat.jdbc.pool.DataSource(); } @Bean public SqlSessionFactory sqlSessionFactoryBean() throws Exception { SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean(); sqlSessionFactoryBean.setDataSource(dataSource()); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:/mybatis/*.xml")); return sqlSessionFactoryBean.getObject(); } @Bean public PlatformTransactionManager transactionManager() { return new DataSourceTransactionManager(dataSource()); } /** * Start */ public static void main(String[] args) { SpringApplication.run(Application.class, args); logger.info("SpringBoot Start Success"); } }

springboot+mybatis 项目 配置多个数据源(mysql和oracle)出错,请大神帮忙看看,急急急!!!跪谢!!!

![图片说明](https://img-ask.csdn.net/upload/201901/16/1547628653_376131.png)![图片说明](https://img-ask.csdn.net/upload/201901/16/1547628662_153121.png)![图片说明](https://img-ask.csdn.net/upload/201901/16/1547628667_342638.png)![图片说明](https://img-ask.csdn.net/upload/201901/16/1547628673_748493.png)![图片说明](https://img-ask.csdn.net/upload/201901/16/1547628677_135355.png)![图片说明](https://img-ask.csdn.net/upload/201901/16/1547628683_140741.png)![图片说明](https://img-ask.csdn.net/upload/201901/16/1547628688_707663.png)![图片说明](https://img-ask.csdn.net/upload/201901/16/1547628692_160621.png)![图片说明](https://img-ask.csdn.net/upload/201901/16/1547628697_604537.png)

SpringBoot + MyBatis插入数据时乱码

SpringBoot + MyBatis插入数据时乱码应该怎么解决

springboot mybatis 动态表名后缀配置

比如现在数据库有不同版本的用户表 user_v1.5 ,user_v1.6,user_v1.7 现在我想通过配置,来读取不同版本的表 (配置v1.5 程序全局就读取user_v1.5这张表)

springboot mybatis sqlserver 事务无法回滚

springboot mybatis sqlserver 事务无法回滚 控制台提示如下 明明已经加入了事务管理,抛出异常还是不会回滚 13:58:03.061 [http-nio-9000-exec-15] INFO c.n.c.u.d.DynamicDataSourceContextHolder - [setDataSourceType,26] - 切换到SQLSERVER_ERP数据源 Creating a new SqlSession Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5a38ece8] JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@595277fa] will be managed by Spring SQL提示巴拉巴拉 Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5a38ece8] Fetched SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5a38ece8] from current transaction SQL提示巴拉巴拉 Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5a38ece8] Fetched SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5a38ece8] from current transaction **执行插入sql,插入后执行 int a = 1/0;** Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5a38ece8] Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5a38ece8] Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5a38ece8] 13:58:03.313 [http-nio-9000-exec-15] ERROR c.n.f.e.GlobalExceptionHandler - [notFount,64] - 运行时异常: java.lang.ArithmeticException: / by zero at com.nbpt.yygs.service.hkhxkh.impl.YygsHkhxServiceImpl.excuteUpdateAndInsert(YygsHkhxServiceImpl.java:274) at com.nbpt.yygs.service.hkhxkh.impl.YygsHkhxServiceImpl.hexiao(YygsHkhxServiceImpl.java:245) at com.nbpt.yygs.service.hkhxkh.impl.YygsHkhxServiceImpl.ywyzidonghexiao(YygsHkhxServiceImpl.java:84) at com.nbpt.yygs.service.hkhxkh.impl.YygsHkhxServiceImpl$$FastClassBySpringCGLIB$$a7103f4.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88) at com.nbpt.framework.aspectj.DataSourceAspect.around(DataSourceAspect.java:53) 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.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) at com.nbpt.yygs.service.hkhxkh.impl.YygsHkhxServiceImpl$$EnhancerBySpringCGLIB$$971cc6f.ywyzidonghexiao(<generated>) at com.nbpt.yygs.service.hkhxkh.impl.YygsHkhxServiceImpl$$FastClassBySpringCGLIB$$a7103f4.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) at com.nbpt.yygs.service.hkhxkh.impl.YygsHkhxServiceImpl$$EnhancerBySpringCGLIB$$da33e29b.ywyzidonghexiao(<generated>) at com.nbpt.web.yygs.hkhxkh.YygsHkhxController.ywyzidonghexiao(YygsHkhxController.java:90) 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:189) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908) at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387) at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:791) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) 13:58:03.316 [http-nio-9000-exec-15] WARN o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver - [logException,194] - Resolved [java.lang.ArithmeticException: / by zero]

springboot整合mybatis中逆向生成的xxxExample文件

最近整合springboot+mybatis时候遇见两个问题, 一开始我用springboot2.1版本mysql8版本死活运行不了,一个劲找不到service的bean。 然后我换成了springboot2.0版本和mysql5.1版本就可以运行。 另外我按照网上的那些教材,发现当生成的model只有xxx一个时候,就没问题,而同时生成xxx和xxxExample时候,运行就会报错,说mapper无法生成bean,而生成时候取消Example就能正常运行。 没找到原因,头大。

springboot+mybatis事务使用

大家好我使用springboot集成mybatis,在一个业务处理中使用for循环插入数据, 比如list中有十条数据,for执行mappe.insert(user)十次,我的理解是方法上使用了 ``` @Transactional ``` 如果后面insert报错,前面插入的数据也会回滚,但是实际没有,我的理解哪里有问题吗?

springboot 配置多库之后,mybatis在控制台不打印sql语句了

springboot项目 单库下,mybatis只需要添加如下配置,就可以打印sql语句 ```xml <!-- 打印查询语句 --> <setting name="logImpl" value="STDOUT_LOGGING" /> ``` 但是多库环境下,mybatis不论怎么设置,都无法打印sql语句..... ---- ---- 项目中的相关配置: mybatis配置: ```xml <!-- 设置运行参数 --> <settings> <!-- 全局映射器启用缓存 --> <setting name="cacheEnabled" value="true" /> <!-- 查询时,关闭关联对象及时加载以提高性能 --> <setting name="lazyLoadingEnabled" value="false" /> <!-- 设置关联对象加载的形态,此处为按需加载字段(加载字段由SQL指定),不会加载关联表的所有字段,以提高性能 --> <setting name="aggressiveLazyLoading" value="false" /> <!-- 对于位置的SQL查询,允许返回不同的结果集以达到通用的效果 --> <setting name="multipleResultSetsEnabled" value="true" /> <!-- 允许使用列标签代替列明 --> <setting name="useColumnLabel" value="true" /> <!-- 允许使用自定义的主键值(比如由程序生成的UUID 32位编码作为键值), 数据表的pk生成策略将被覆盖 --> <setting name="useGeneratedKeys" value="true" /> <!-- 给予被嵌套的resultMap以字段-属性的映射支持 --> <setting name="autoMappingBehavior" value="PARTIAL" /> <!-- 对于批量更新操作缓存SQL以提高性能 --> <setting name="defaultExecutorType" value="REUSE" /> <!-- 数据库超过25000秒仍未响应则超时 --> <!--<setting name="defaultStatementTimeout" value="25000" />--> <!-- 打印查询语句 --> <setting name="logImpl" value="STDOUT_LOGGING" /> <!-- 开启驼峰--> <setting name="mapUnderscoreToCamelCase" value="true" /> </settings> ``` logback配置: ```xml <?xml version="1.0" encoding="UTF-8"?> <configuration scan="true"> <!-- 属性1:每个logger都关联到logger上下文,默认上下文名称为“default”。 但可以使用设置成其他名字,用于区分不同应用程序的记录。一旦设置,不能修改,可以通过%contextName来打印日志上下文名称。 --> <contextName>logback</contextName> <!--属性2:定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径--> <!-- <springProfile name="dev"> <property name="LOG_PATH" value="D://care-management-statisticserver-logs"/> </springProfile> <springProfile name="test"> <property name="LOG_PATH" value="/data/tomcat_jar/taixin_care/care-management-statisticserver/logs"/> </springProfile> <springProfile name="prod"> <property name="LOG_PATH" value="/data1/logs/care-management-statisticserver"/> </springProfile> --> <property name="LOG_PATH" value="${LOG_FILE}"/> <!--appender用来格式化日志输出节点,有俩个属性name和class,class用来指定哪种输出策略,常用就是控制台输出策略和文件输出策略。--> <!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <level>info</level> </filter> <encoder> <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n</pattern> </encoder> </appender> <!--<include resource="org/springframework/boot/logging/logback/base.xml"/>--> <!-- 说明: 1、日志级别及文件 日志记录采用分级记录,级别与日志文件名相对应,不同级别的日志信息记录到不同的日志文件中 例如:error级别记录到log_error_xxx.log或log_error.log(该文件为当前记录的日志文件),而log_error_xxx.log为归档日志, 日志文件按日期记录,同一天内,若日志文件大小等于或大于2M,则按0、1、2...顺序分别命名 例如log-level-2013-12-21.0.log 其它级别的日志也是如此。 2、文件路径 若开发、测试用,在Eclipse中运行项目,则到Eclipse的安装路径查找logs文件夹,以相对路径../logs。 若部署到Tomcat下,则在Tomcat下的logs文件中 3、Appender FILEERROR对应error级别,文件名以log-error-xxx.log形式命名 FILEWARN对应warn级别,文件名以log-warn-xxx.log形式命名 FILEINFO对应info级别,文件名以log-info-xxx.log形式命名 FILEDEBUG对应debug级别,文件名以log-debug-xxx.log形式命名 CONSOLE将日志信息输出到控制上,为方便开发测试使用 --> <!-- 日志记录器,日期滚动记录 --> <appender name="FILEERROR" class="ch.qos.logback.core.rolling.RollingFileAppender"> <!-- 正在记录的日志文件的路径及文件名 --> <file>${LOG_PATH}/error_statisticserver.log</file> <!-- 日志记录器的滚动策略,按日期,按大小记录 --> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- 归档的日志文件的路径,例如今天是2013-12-21日志,当前写的日志文件路径为file节点指定,可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。 而2013-12-21的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 --> <fileNamePattern>${LOG_PATH}/error-statisticserver-%d{yyyy-MM-dd}.%i.log</fileNamePattern> <!-- 表示只保留最近30天的日志,以防止日志填满整个磁盘空间。--> <maxHistory>30</maxHistory> <!--用来指定日志文件的上限大小,例如设置为1GB的话,那么到了这个值,就会删除旧的日志。--> <totalSizeCap>1GB</totalSizeCap> <!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始, 命名日志文件,例如log-error-2013-12-21.0.log --> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>100MB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> <!-- 追加方式记录日志 --> <append>true</append> <!-- 日志文件的格式 --> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n</pattern> <charset>utf-8</charset> </encoder> <!-- 此日志文件只记录error级别的 --> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>ERROR</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> </appender> <!-- 日志记录器,日期滚动记录 --> <appender name="FILEINFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> <!-- 正在记录的日志文件的路径及文件名 --> <file>${LOG_PATH}/info_statisticserver.log</file> <!-- 日志记录器的滚动策略,按日期,按大小记录 --> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- 归档的日志文件的路径,例如今天是2013-12-21日志,当前写的日志文件路径为file节点指定,可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。 而2013-12-21的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 --> <fileNamePattern>${LOG_PATH}/info-statisticserver-%d{yyyy-MM-dd}.%i.log</fileNamePattern> <!-- 表示只保留最近30天的日志,以防止日志填满整个磁盘空间。--> <maxHistory>30</maxHistory> <!--用来指定日志文件的上限大小,例如设置为1GB的话,那么到了这个值,就会删除旧的日志。--> <totalSizeCap>1GB</totalSizeCap> <!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始,命名日志文件,例如log-error-2013-12-21.0.log --> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>100MB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> <!-- 追加方式记录日志 --> <append>true</append> <!-- 日志文件的格式 --> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern>%date %level [%thread] %logger{36} [%file : %line] %msg%n</pattern> <charset>utf-8</charset> </encoder> <!-- 此日志文件只记录info级别的 --> <filter class="ch.qos.logback.classic.filter.LevelFilter"> <level>INFO</level> <onMatch>ACCEPT</onMatch> <onMismatch>DENY</onMismatch> </filter> </appender> <!-- <logger>用来设置某一个包或者具体的某一个类的日志打印级别、以及指定<appender>。<logger>仅有一个name属性,一个可选的level和一个可选的addtivity属性。 --> <logger name="org.springframework" level="INFO"/> <logger name="org.apache" level="ERROR"/> <logger name="org.hibernate.validator" level="ERROR"/> <!--<logger name="org.thymeleaf" level="ERROR"/>--> <logger name="org.springframework.context.annotation" level="ERROR"/> <!-- springProfile多环境日志输出,据不同环境(prod:生产环境,test:测试环境,dev:开发环境)来定义不同的日志输出--> <springProfile name="dev" /> <root level="INFO"> <appender-ref ref="FILEERROR"/> <appender-ref ref="FILEINFO"/> <appender-ref ref="STDOUT"/> </root> <!-- 可以启动服务的时候指定 profile (如不指定使用默认),如指定prod 的方式为: java -jar xxx.jar –spring.profiles.active=prod--> </configuration> ``` application.properties部分配置: ```properties #配置文件 logging.level.tk.mybatis=TRACE spring.freemarker.cache=false spring.freemarker.request-context-attribute=request mybatis.type-aliases-package=com.mtpf.domain mybatis.mapper-locations=classpath:mapper/*.xml mapper.mappers=com.mtpf.util.MyMapper mapper.not-empty=false mapper.identity=MYSQL pagehelper.helperDialect=mysql #true 是超出最大页码返回数据 false超出最大页码不返回数据 pagehelper.reasonable=${PAGEHELPER_REASONABLE} pagehelper.supportMethodsArguments=true pagehelper.params=count=countSql ```

spring boot mybatis 启动后动态的创建、加载、使用数据源

我现在有有场景,通过web动态创建mysql数据库,同时新增用户名和密码,此时web平台运行中需要对这个新创建出来的数据库,在spring boot运行中创建这个数据源,加载这个数据源,然后通过传入的标识对应使用这个数据源 没有C币 求高手解答

springboot +mybatis,配置了数据源,启动还是报错,百度,千篇一律的答案都不是我要的

已经配置了mybatis,如下: ``` <environments default="development"> <environment id="development"> <transactionManager type="JDBC"></transactionManager> <dataSource type="POOLED"> <property name="driver" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://127.0.0.1:3306/db_cloudplatform" /> <property name="username" value="root"/> <property name="password" value="myc123456" /> <!-- 初始化连接大小 --> <property name="initialSize" value="10" /> <!-- 连接池最大数量 --> <property name="maxActive" value="60" /> <!-- 连接池最大空闲 --> <property name="maxIdle" value="60" /> <!-- 连接池最小空闲 --> <property name="minIdle" value="2" /> <!-- 获取连接最大等待时间 --> <property name="maxWait" value="6000" /> <!--<property name="timeBetweenEvictionRunsMillis" value="${timeBetweenEvictionRunsMillis}"/> <property name="minEvictableIdleTimeMillis" value="${minEvictableIdleTimeMillis}"/> <property name="validationQuery" value="${validationQuery}"/>--> </dataSource> </environment> </environments> ``` 启动一直报错: ``` Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. Reason: Failed to determine a suitable driver class Action: Consider the following: If you want an embedded database (H2, HSQL or Derby), please put it on the classpath. If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active). ``` 望高手指点

springboot+mybatis多表关联查询

第一张表 app id app_type 5 2 第二张表 id app_type app_name 1 0 A 2 0 B 3 0 C 4 1 D 5 2 E 6 3 F 输入参数为5,查询到app_type, 然后在第二张表中根据app_type 2查询他的app_name, 同时也要加上app_type为0的app_name,怎样查询? 怎样根据参数联表查询然后还要加上app_type为0的内容?

用springboot+mybatis取出数据contant字段总是显示null(查了一下午debug没找出来)

实现类 ``` public Page<Person> getNewPersonList( Integer currentPage, Integer pageSize) { // 实例化查询条件 final PersonExample personExample = new PersonExample(); PersonExample.Criteria criteria = personExample.createCriteria(); criteria.andIsDeleteEqualTo((byte)0); // 获取查询结果集 Page<Person> result = PageHelper.startPage(currentPage, pageSize).doSelectPage(new ISelect() { @Override public void doSelect() { // personRepository.selectByExample(personExample); personRepository.selectByExample(personExample); } }); return result; } ``` 其中返回值得实体类的代码: ``` package com.ebiz.code.repository.api.entity; import java.util.Date; public class Person { /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column ebiz_person.id * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ private Integer id; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column ebiz_person.name * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ private String name; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column ebiz_person.duty * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ private String duty; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column ebiz_person.Email * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ private String email; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column ebiz_person.phone * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ private String phone; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column ebiz_person.place * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ private String place; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column ebiz_person.is_delete * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ private Byte isDelete; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column ebiz_person.create_time * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ private Date createTime; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column ebiz_person.update_time * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ private Date updateTime; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column ebiz_person.photo * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ private String photo; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column ebiz_person.type * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ private Byte type; /** * * This field was generated by MyBatis Generator. * This field corresponds to the database column ebiz_person.contant * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ private String contant; /** * This method was generated by MyBatis Generator. * This method returns the value of the database column ebiz_person.id * * @return the value of ebiz_person.id * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public Integer getId() { return id; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column ebiz_person.id * * @param id the value for ebiz_person.id * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public void setId(Integer id) { this.id = id; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column ebiz_person.name * * @return the value of ebiz_person.name * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public String getName() { return name; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column ebiz_person.name * * @param name the value for ebiz_person.name * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public void setName(String name) { this.name = name; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column ebiz_person.duty * * @return the value of ebiz_person.duty * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public String getDuty() { return duty; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column ebiz_person.duty * * @param duty the value for ebiz_person.duty * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public void setDuty(String duty) { this.duty = duty; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column ebiz_person.Email * * @return the value of ebiz_person.Email * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public String getEmail() { return email; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column ebiz_person.Email * * @param email the value for ebiz_person.Email * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public void setEmail(String email) { this.email = email; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column ebiz_person.phone * * @return the value of ebiz_person.phone * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public String getPhone() { return phone; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column ebiz_person.phone * * @param phone the value for ebiz_person.phone * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public void setPhone(String phone) { this.phone = phone; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column ebiz_person.place * * @return the value of ebiz_person.place * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public String getPlace() { return place; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column ebiz_person.place * * @param place the value for ebiz_person.place * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public void setPlace(String place) { this.place = place; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column ebiz_person.is_delete * * @return the value of ebiz_person.is_delete * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public Byte getIsDelete() { return isDelete; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column ebiz_person.is_delete * * @param isDelete the value for ebiz_person.is_delete * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public void setIsDelete(Byte isDelete) { this.isDelete = isDelete; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column ebiz_person.create_time * * @return the value of ebiz_person.create_time * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public Date getCreateTime() { return createTime; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column ebiz_person.create_time * * @param createTime the value for ebiz_person.create_time * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public void setCreateTime(Date createTime) { this.createTime = createTime; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column ebiz_person.update_time * * @return the value of ebiz_person.update_time * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public Date getUpdateTime() { return updateTime; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column ebiz_person.update_time * * @param updateTime the value for ebiz_person.update_time * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column ebiz_person.photo * * @return the value of ebiz_person.photo * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public String getPhoto() { return photo; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column ebiz_person.photo * * @param photo the value for ebiz_person.photo * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public void setPhoto(String photo) { this.photo = photo; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column ebiz_person.type * * @return the value of ebiz_person.type * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public Byte getType() { return type; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column ebiz_person.type * * @param type the value for ebiz_person.type * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public void setType(Byte type) { this.type = type; } /** * This method was generated by MyBatis Generator. * This method returns the value of the database column ebiz_person.contant * * @return the value of ebiz_person.contant * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public String getContant() { return contant; } /** * This method was generated by MyBatis Generator. * This method sets the value of the database column ebiz_person.contant * * @param contant the value for ebiz_person.contant * * @mbg.generated Sat May 11 13:04:24 CST 2019 */ public void setContant(String contant) { this.contant = contant; } } ``` 数据库图字段没写错 ![图片说明](https://img-ask.csdn.net/upload/201905/11/1557568172_353594.png)

Springboot下mybatis如何配置databaseId

Springboot设置了mybatis.config-location,然后在mybatis-config.xml下配置了databaseIdProvider type="DB_VENDOR" <databaseIdProvider type="DB_VENDOR"> <property name="DB2" value="db2"/> <property name="Oracle" value="oracle" /> <property name="Adaptive Server Enterprise" value="sybase"/> <property name="MySQL" value="mysql" /> </databaseIdProvider> 但是不会生效,调试发现初始化时由于Database是在application.propertities下定义的,mybatis初始化时会检测Environment是否为null,为null则不设置databaseId,在Spring下知道如何配置,但是SpringBoot下搞不定,求大神指点

springboot+mybatis+db2+vue

问题是这样的springboot+mybatis连接db2查询数据库 要1分钟有4600条数据 我看了看写的代码 用了javafor循环递归查询子机构 我改成数据库递归有就快了10几秒 在改成异步还是慢 我想了想 能不能先查询父机构 再点击父机构再去根据父机构查询子机构 思路倒是出来了 前端vue不知道怎么处理 tree树形菜单 求指点

Springboot Druid +mybatis 多数据源监控,只能监控到主库SQL,从库不行

配置如下 spring: circle-datasource: #从库 #123.207.23.166:3306 name: db url: jdbc:mysql://119.29.208.67:3307/ws?useSSL=false&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;allowMultiQueries=true username: root password: ***** driver-class-name: com.mysql.jdbc.Driver type: com.alibaba.druid.pool.DruidDataSource minIdle: 5 maxActive: 100 initialSize: 10 maxWait: 60000 timeBetweenEvictionRunsMillis: 60000 minEvictableIdleTimeMillis: 300000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false testOnReturn: false poolPreparedStatements: true maxPoolPreparedStatementPerConnectionSize: 50 removeAbandoned: true spring: datasource: #主库 #123.207.23.166:3306 name: db url: jdbc:mysql://119.29.208.67:3306/ws?useSSL=false&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;allowMultiQueries=true username: momo password: ***** driver-class-name: com.mysql.jdbc.Driver type: com.alibaba.druid.pool.DruidDataSource minIdle: 5 maxActive: 100 initialSize: 10 maxWait: 60000 timeBetweenEvictionRunsMillis: 60000 minEvictableIdleTimeMillis: 300000 validationQuery: select 'x' testWhileIdle: true testOnBorrow: false testOnReturn: false poolPreparedStatements: true maxPoolPreparedStatementPerConnectionSize: 50 removeAbandoned: true filters: stat connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 # 通过connectProperties属性来打开mergeSql功能;慢SQL记录 useGlobalDataSourceStat: true # 合并多个DruidDataSource的监控数据 druidLoginName: momo # 登录druid的账号 druidPassword: momo # 登录druid的密码 ---------------------------------------------- @Bean(name="circleDataSource",destroyMethod = "close", initMethod="init") public DataSource dataSource(){ DruidDataSource datasource = new DruidDataSource(); try { datasource.setUrl(this.url); datasource.setDbType(type); datasource.setUsername(username); datasource.setPassword(password); datasource.setDriverClassName(driverClassName); datasource.setInitialSize(initialSize); datasource.setMinIdle(minIdle); datasource.setMaxActive(maxActive); datasource.setMaxWait(maxWait); datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); datasource.setValidationQuery(validationQuery); datasource.setTestWhileIdle(testWhileIdle); datasource.setTestOnBorrow(testOnBorrow); datasource.setTestOnReturn(testOnReturn); datasource.setPoolPreparedStatements(poolPreparedStatements); datasource.setFilters(filters); datasource.setUseGlobalDataSourceStat(true); } catch (Exception e) { logger.error("druid configuration initialization filter", e); } return datasource; } ---------------------主库------- @Bean(name="dataSource",destroyMethod = "close", initMethod="init") @Primary //不要漏了这 public DataSource dataSource(){ DruidDataSource datasource = new DruidDataSource(); try { datasource.setUrl(this.dbUrl); datasource.setDbType(dbType); datasource.setUsername(username); datasource.setPassword(password); datasource.setDriverClassName(driverClassName); datasource.setInitialSize(initialSize); datasource.setMinIdle(minIdle); datasource.setMaxActive(maxActive); datasource.setMaxWait(maxWait); datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); datasource.setValidationQuery(validationQuery); datasource.setTestWhileIdle(testWhileIdle); datasource.setTestOnBorrow(testOnBorrow); datasource.setTestOnReturn(testOnReturn); datasource.setPoolPreparedStatements(poolPreparedStatements); datasource.setFilters(filters); datasource.setUseGlobalDataSourceStat(true); } catch (SQLException e) { logger.error("druid configuration initialization filter", e); } return datasource; } ///////// 下面是druid 监控访问的设置 ///////////////// @Bean public ServletRegistrationBean druidServlet() { ServletRegistrationBean reg = new ServletRegistrationBean(); reg.setServlet(new StatViewServlet()); reg.addUrlMappings("/druid/*"); //url 匹配 // reg.addInitParameter("allow", "192.168.16.110,127.0.0.1"); // IP白名单 (没有配置或者为空,则允许所有访问) // reg.addInitParameter("deny", "192.168.16.111"); //IP黑名单 (存在共同时,deny优先于allow) reg.addInitParameter("loginUsername", this.druidLoginName);//登录名 reg.addInitParameter("loginPassword", this.druidPassword);//登录密码 reg.addInitParameter("resetEnable", "false"); // 禁用HTML页面上的“Reset All”功能 return reg; } @Bean(name="druidWebStatFilter") public FilterRegistrationBean filterRegistrationBean() { FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(); filterRegistrationBean.setFilter(new WebStatFilter()); filterRegistrationBean.addUrlPatterns("/*"); filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"); //忽略资源 filterRegistrationBean.addInitParameter("profileEnable", "true"); filterRegistrationBean.addInitParameter("principalCookieName", "USER_COOKIE"); filterRegistrationBean.addInitParameter("principalSessionName", "USER_SESSION"); return filterRegistrationBean; } ---------------------------------------------------- ![图片说明](https://img-ask.csdn.net/upload/201807/21/1532162386_693657.png) 从库在数据源是监控了,但是sql没有 ![图片说明](https://img-ask.csdn.net/upload/201807/21/1532162432_671619.png)

C/C++学习指南全套教程

C/C++学习的全套教程,从基本语法,基本原理,到界面开发、网络开发、Linux开发、安全算法,应用尽用。由毕业于清华大学的业内人士执课,为C/C++编程爱好者的教程。

定量遥感中文版 梁顺林著 范闻捷译

这是梁顺林的定量遥感的中文版,由范闻捷等翻译的,是电子版PDF,解决了大家看英文费时费事的问题,希望大家下载看看,一定会有帮助的

YOLOv3目标检测实战:训练自己的数据集

YOLOv3是一种基于深度学习的端到端实时目标检测方法,以速度快见长。本课程将手把手地教大家使用labelImg标注和使用YOLOv3训练自己的数据集。课程分为三个小项目:足球目标检测(单目标检测)、梅西目标检测(单目标检测)、足球和梅西同时目标检测(两目标检测)。 本课程的YOLOv3使用Darknet,在Ubuntu系统上做项目演示。包括:安装Darknet、给自己的数据集打标签、整理自己的数据集、修改配置文件、训练自己的数据集、测试训练出的网络模型、性能统计(mAP计算和画出PR曲线)和先验框聚类。 Darknet是使用C语言实现的轻型开源深度学习框架,依赖少,可移植性好,值得深入探究。 除本课程《YOLOv3目标检测实战:训练自己的数据集》外,本人推出了有关YOLOv3目标检测的系列课程,请持续关注该系列的其它课程视频,包括: 《YOLOv3目标检测实战:交通标志识别》 《YOLOv3目标检测:原理与源码解析》 《YOLOv3目标检测:网络模型改进方法》 敬请关注并选择学习!

sql语句 异常 Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your

在我们开发的工程中,有时候会报 [Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ------ 这种异常 不用多想,肯定是我们的sql语句出现问题,下面...

浪潮集团 往年的软件类 笔试题 比较详细的哦

浪潮集团 往年的软件类 笔试题 比较详细的哦

2019 AI开发者大会

2019 AI开发者大会(AI ProCon 2019)是由中国IT社区CSDN主办的AI技术与产业年度盛会。多年经验淬炼,如今蓄势待发:2019年9月6-7日,大会将有近百位中美顶尖AI专家、知名企业代表以及千余名AI开发者齐聚北京,进行技术解读和产业论证。我们不空谈口号,只谈技术,诚挚邀请AI业内人士一起共铸人工智能新篇章!

I2c串口通信实现加速度传感器和FPGA的交流

此代码能实现加速度传感器与FPGA之间的交流,从而测出运动物体的加速度。

Python可以这样学(第一季:Python内功修炼)

董付国系列教材《Python程序设计基础》、《Python程序设计(第2版)》、《Python可以这样学》配套视频,讲解Python 3.5.x和3.6.x语法、内置对象用法、选择与循环以及函数设计与使用、lambda表达式用法、字符串与正则表达式应用、面向对象编程、文本文件与二进制文件操作、目录操作与系统运维、异常处理结构。

微信公众平台开发入门

本套课程的设计完全是为初学者量身打造,课程内容由浅入深,课程讲解通俗易懂,代码实现简洁清晰。通过本课程的学习,学员能够入门微信公众平台开发,能够胜任企业级的订阅号、服务号、企业号的应用开发工作。 通过本课程的学习,学员能够对微信公众平台有一个清晰的、系统性的认识。例如,公众号是什么,它有什么特点,它能做什么,怎么开发公众号。 其次,通过本课程的学习,学员能够掌握微信公众平台开发的方法、技术和应用实现。例如,开发者文档怎么看,开发环境怎么搭建,基本的消息交互如何实现,常用的方法技巧有哪些,真实应用怎么开发。

机器学习初学者必会的案例精讲

通过六个实际的编码项目,带领同学入门人工智能。这些项目涉及机器学习(回归,分类,聚类),深度学习(神经网络),底层数学算法,Weka数据挖掘,利用Git开源项目实战等。

eclipseme 1.7.9

eclipse 出了新的eclipseme插件,官方有下载,但特慢,我都下了大半天(可能自己网速差)。有急需要的朋友可以下哦。。。

Spring Boot -01- 快速入门篇(图文教程)

Spring Boot -01- 快速入门篇 今天开始不断整理 Spring Boot 2.0 版本学习笔记,大家可以在博客看到我的笔记,然后大家想看视频课程也可以到【慕课网】手机 app,去找【Spring Boot 2.0 深度实践】的课程,令人开心的是,课程完全免费! 什么是 Spring Boot? Spring Boot 是由 Pivotal 团队提供的全新框架。Spring Boot...

HoloLens2开发入门教程

本课程为HoloLens2开发入门教程,讲解部署开发环境,安装VS2019,Unity版本,Windows SDK,创建Unity项目,讲解如何使用MRTK,编辑器模拟手势交互,打包VS工程并编译部署应用到HoloLens上等。

最简单的倍频verilog程序(Quartus II)

一个工程文件 几段简单的代码 一个输入一个输出(50Mhz倍频到100Mhz)

计算机组成原理实验教程

西北工业大学计算机组成原理实验课唐都仪器实验帮助,同实验指导书。分为运算器,存储器,控制器,模型计算机,输入输出系统5个章节

4小时玩转微信小程序——基础入门与微信支付实战

这是一个门针对零基础学员学习微信小程序开发的视频教学课程。课程采用腾讯官方文档作为教程的唯一技术资料来源。杜绝网络上质量良莠不齐的资料给学员学习带来的障碍。 视频课程按照开发工具的下载、安装、使用、程序结构、视图层、逻辑层、微信小程序等几个部分组织课程,详细讲解整个小程序的开发过程

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

基于RSA通信密钥分发的加密通信

基于RSA通信密钥分发的加密通信,采用pycrypto中的RSA、AES模块实现

不同变质程度煤尘爆炸残留气体特征研究

为分析不同变质程度煤尘爆炸残留气体成分的特征规律,利用水平管道煤尘爆炸实验装置进行了贫瘦煤、肥煤、气煤、长焰煤4种不同变质程度的煤尘爆炸实验,研究了不同变质程度煤尘爆炸后气体残留物含量的差异,并对气体

设计模式(JAVA语言实现)--20种设计模式附带源码

课程亮点: 课程培训详细的笔记以及实例代码,让学员开始掌握设计模式知识点 课程内容: 工厂模式、桥接模式、组合模式、装饰器模式、外观模式、享元模式、原型模型、代理模式、单例模式、适配器模式 策略模式、模板方法模式、观察者模式、迭代器模式、责任链模式、命令模式、备忘录模式、状态模式、访问者模式 课程特色: 笔记设计模式,用笔记串连所有知识点,让学员从一点一滴积累,学习过程无压力 笔记标题采用关键字标识法,帮助学员更加容易记住知识点 笔记以超链接形式让知识点关联起来,形式知识体系 采用先概念后实例再应用方式,知识点深入浅出 提供授课内容笔记作为课后复习以及工作备查工具 部分图表(电脑PC端查看):

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

软件测试2小时入门

本课程内容系统、全面、简洁、通俗易懂,通过2个多小时的介绍,让大家对软件测试有个系统的理解和认识,具备基本的软件测试理论基础。 主要内容分为5个部分: 1 软件测试概述,了解测试是什么、测试的对象、原则、流程、方法、模型;&nbsp; 2.常用的黑盒测试用例设计方法及示例演示;&nbsp; 3 常用白盒测试用例设计方法及示例演示;&nbsp; 4.自动化测试优缺点、使用范围及示例‘;&nbsp; 5.测试经验谈。

几率大的Redis面试题(含答案)

本文的面试题如下: Redis 持久化机制 缓存雪崩、缓存穿透、缓存预热、缓存更新、缓存降级等问题 热点数据和冷数据是什么 Memcache与Redis的区别都有哪些? 单线程的redis为什么这么快 redis的数据类型,以及每种数据类型的使用场景,Redis 内部结构 redis的过期策略以及内存淘汰机制【~】 Redis 为什么是单线程的,优点 如何解决redis的并发竞争key问题 Red...

手把手实现Java图书管理系统(附源码)

【超实用课程内容】 本课程演示的是一套基于Java的SSM框架实现的图书管理系统,主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的java人群。详细介绍了图书管理系统的实现,包括:环境搭建、系统业务、技术实现、项目运行、功能演示、系统扩展等,以通俗易懂的方式,手把手的带你从零开始运行本套图书管理系统,该项目附带全部源码可作为毕设使用。 【课程如何观看?】 PC端:https://edu.csdn.net/course/detail/27513 移动端:CSDN 学院APP(注意不是CSDN APP哦) 本课程为录播课,课程2年有效观看时长,大家可以抓紧时间学习后一起讨论哦~ 【学员专享增值服务】 源码开放 课件、课程案例代码完全开放给你,你可以根据所学知识,自行修改、优化

jsp+servlet入门项目实例

jsp+servlet实现班级信息管理项目

winfrom中嵌套html,跟html的交互

winfrom中嵌套html,跟html的交互,源码就在里面一看就懂,很简单

Java面试题大全(2020版)

发现网上很多Java面试题都没有答案,所以花了很长时间搜集整理出来了这套Java面试题大全,希望对大家有帮助哈~ 本套Java面试题大全,全的不能再全,哈哈~ 一、Java 基础 1. JDK 和 JRE 有什么区别? JDK:Java Development Kit 的简称,java 开发工具包,提供了 java 的开发环境和运行环境。 JRE:Java Runtime Environ...

python实现数字水印添加与提取及鲁棒性测试(GUI,基于DCT,含测试图片)

由python写的GUI,可以实现数字水印的添加与提取,提取是根据添加系数的相关性,实现了盲提取。含有两种攻击测试方法(高斯低通滤波、高斯白噪声)。基于python2.7,watermark.py为主

Xshell6完美破解版,亲测可用

Xshell6破解版,亲测可用,分享给大家。直接解压即可使用

你连存活到JDK8中著名的Bug都不知道,我怎么敢给你加薪

CopyOnWriteArrayList.java和ArrayList.java,这2个类的构造函数,注释中有一句话 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 public ArrayList(Collection&lt;? ...

相关热词 c#对文件改写权限 c#中tostring c#支付宝回掉 c#转换成数字 c#判断除法是否有模 c# 横向chart c#控件选择多个 c#报表如何锁定表头 c#分级显示数据 c# 不区分大小写替换
立即提问
相关内容推荐