web.xml

  1. <!-- ================================================================================ -->
  2. <!-- jndi configure -->
  3. <!-- ================================================================================ -->
  4. <resource-ref> <!-- adapt weblogic server -->
  5. <res-ref-name>jndi_base</res-ref-name>
  6. <res-auth>Container</res-auth>
  7. <mapped-name>jndi_wmsc</mapped-name>
  8. </resource-ref>

webapp文件夹下META-INF文件夹下context.xml

  1. <?xml version='1.0' encoding='utf-8'?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one or more
  4. contributor license agreements. See the NOTICE file distributed with
  5. this work for additional information regarding copyright ownership.
  6. The ASF licenses this file to You under the Apache License, Version 2.0
  7. (the "License"); you may not use this file except in compliance with
  8. the License. You may obtain a copy of the License at
  9.  
  10. http://www.apache.org/licenses/LICENSE-2.0
  11.  
  12. Unless required by applicable law or agreed to in writing, software
  13. distributed under the License is distributed on an "AS IS" BASIS,
  14. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. See the License for the specific language governing permissions and
  16. limitations under the License.
  17. -->
  18. <!-- The contents of this file will be loaded for each web application -->
  19. <Context>
  20.  
  21. <!-- Default set of monitored resources -->
  22. <WatchedResource>WEB-INF/web.xml</WatchedResource>
  23.  
  24. <!-- Uncomment this to disable session persistence across Tomcat restarts -->
  25. <!--
  26. <Manager pathname="" />
  27. -->
  28.  
  29. <!-- Uncomment this to enable Comet connection tacking (provides events
  30. on session expiration as well as webapp lifecycle) -->
  31. <!--
  32. <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
  33. -->
  34. <!--测试环境YD_SERVER数据库连接地址 -->
  35. <Resource name="jndi_wmsc" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="ggs" password="mxDUF6IgMjEq3ClI" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://10.19.105.234:3306/wmsc?characterEncoding=utf8&amp;zeroDateTimeBehavior=convertToNull" />
  36. </Context>

applicationContext.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:mvc="http://www.springframework.org/schema/mvc"
  5. xmlns:tx="http://www.springframework.org/schema/tx"
  6. xmlns:jee="http://www.springframework.org/schema/jee"
  7. xmlns:aop="http://www.springframework.org/schema/aop"
  8. xmlns:context="http://www.springframework.org/schema/context"
  9. xmlns:task="http://www.springframework.org/schema/task"
  10. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
  11. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
  12. http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
  13. http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
  14. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
  15. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
  16. http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd">
  17.  
  18. <mvc:annotation-driven />
  19. <tx:annotation-driven transaction-manager="transactionManager" />
  20. <aop:aspectj-autoproxy proxy-target-class="true"/>
  21.  
  22. <!-- JNDI数据源-->
  23. <jee:jndi-lookup id="dataSource" jndi-name="jndi_wmsc" resource-ref="true"/>
  24.  
  25. <!-- SPRING JDBC -->
  26. <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
  27. <property name="dataSource" ref="dataSource" />
  28. </bean>
  29. <bean id="namedParameterJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
  30. <constructor-arg ref="dataSource"/>
  31. </bean>
  32.  
  33. <!-- SPRING 事务管理-->
  34. <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  35. <property name="dataSource" ref="dataSource" />
  36. </bean>
  37.  
  38. </beans>
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:mvc="http://www.springframework.org/schema/mvc"
  5. xmlns:tx="http://www.springframework.org/schema/tx"
  6. xmlns:jee="http://www.springframework.org/schema/jee"
  7. xmlns:aop="http://www.springframework.org/schema/aop"
  8. xmlns:context="http://www.springframework.org/schema/context"
  9. xmlns:task="http://www.springframework.org/schema/task"
  10. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
  11. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
  12. http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
  13. http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
  14. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
  15. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
  16. http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd">
  17.  
  18. <import resource="spring-quartz.xml"/>
  19.  
  20. <mvc:annotation-driven />
  21. <tx:annotation-driven transaction-manager="transactionManager" />
  22. <task:annotation-driven/>
  23. <aop:aspectj-autoproxy proxy-target-class="true"/>
  24.  
  25. <!-- 加载配置文件-->
  26. <!-- <context:property-placeholder location="classpath:config.properties"/> -->
  27.  
  28. <!-- JNDI数据源-->
  29. <jee:jndi-lookup id="dataSource" jndi-name="jndi_wmsc" resource-ref="true"/>
  30.  
  31. <!-- SPRING JDBC -->
  32. <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
  33. <property name="dataSource" ref="dataSource" />
  34. </bean>
  35. <bean id="namedParameterJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
  36. <constructor-arg ref="dataSource"/>
  37. </bean>
  38.  
  39. <!-- SPRING 事务管理-->
  40. <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  41. <property name="dataSource" ref="dataSource" />
  42. </bean>
  43.  
  44. <!-- 应用上线文初始化Bean-->
  45. <bean class="com.yd.common.runtime.CIPRuntimeContextInitializer" />
  46.  
  47. <!-- dao,service,controller,component scan -->
  48. <!-- <context:component-scan base-package="com.yd.wmsc" />
  49. <context:component-scan base-package="com.yd.common.function" />
  50. <context:component-scan base-package="com.yd.common.auth" /> -->
  51.  
  52. <context:component-scan base-package="com.yd.wmsc,com.yd.common.function,com.yd.common.auth" >
  53. <context:exclude-filter type="annotation"
  54. expression="org.springframework.stereotype.Controller"/>
  55. </context:component-scan>
  56.  
  57. </beans>

tomcat jndi 数据源的更多相关文章

  1. Linux - tomcat -jndi数据源配置

    Linux - tomcat -jndi数据源配置 tomcat/conf/context .xml 文件中修改如下 <Resource name="/jdbc/--" au ...

  2. Hibernate Tomcat JNDI数据源配置(转)

    简述: 配置JNDI 查找Tomcat 中server.xml中定义的数据源 步骤: 1. 修改elipse的数据源server.xml 主要修改如下, 1. 添加下面这段Context文本 其中St ...

  3. 配置Tomcat JNDI数据源

    原文地址:http://my.oschina.net/xiaomaoandhong/blog/74584 先记录在此,按照博文未配置成功

  4. Spring+Tomcat的JNDI数据源连接池简单配置

    使用Tomcat JNDI数据源与Spring一起使用步骤如下: 1.将数据库驱动复制到Tomcat的lib文件夹下面 2.配置Tomcat的server.xml配置文件,在GlobalNamingR ...

  5. Tomcat下使用c3p0配置jndi数据源

    下载c3p0包: 下载地址:https://sourceforge.net/projects/c3p0/files/?source=navbar 解压后得到包:c3p0-0.9.2.jar,mchan ...

  6. 为tomcat动态添加jndi数据源信息

    我们在开发项目的时候,总要和数据库打交道,如何获取数据源,以什么样的方式来获取,成为了我们即简单又熟悉而且不得不注意的一个问题. 那么在这里我说三种获取数据源的常用方式: 一.通过配置文件来获取 首先 ...

  7. Tomcat 6 JNDI数据源详解

    数据库连接池这个概念应该都不陌生,在Java中连接池也就是数据库的连接池,它是一种采用连接复用的思想避免多次连接造成资源的浪费机制. 最常见的连接池就是DBCP和C30P了,在tomcat中默认使用的 ...

  8. JNDI学习总结(三)——Tomcat下使用Druid配置JNDI数据源

    com.alibaba.druid.pool.DruidDataSourceFactory实现了javax.naming.spi.ObjectFactory,可以作为JNDI数据源来配置. 一.下载D ...

  9. Tomcat中配置JNDI数据源

    准备工作: Tomcat版本:tomcat6.0以上 下例中均使用MySQL数据库 将对应数据源的jar包和MySQL的驱动包拷贝至tomcat的lib文件夹下 一.全局数据源 1步骤一:配置 在to ...

随机推荐

  1. openfire build

    1. build path: a) source folder:包括openfire和各插件的代码. b) libraries:build/lib下jar包和插件下jar包,jdk/lib/tools ...

  2. 什么是Grunt

    Grunt,简而言之,就是运行在Node.js上面的任务管理器(task runner),其可以在任何语言和项目中自动化指定的任务.我们可通过npm来安装Grunt和Grunt插件 为什么使用Grun ...

  3. 安装.NET Core 3.0预览版后VS项目目标框架中不显示的解决方法

    下载了微软在GitHub上的cSharpSamples项目后发现其中一些项目使用框架为.NET Core3.0,就下载了.NET Core3.0,但发现项目依然不可用,编译时提示如下 当前 .net ...

  4. listen 59

    Different Brain Regions Handle Different Music Types (Vivaldi) versus (the Beatles) . Both great. Bu ...

  5. 「LOJ#10042」「一本通 2.1 练习 8」收集雪花 (map

    题目描述 不同的雪花往往有不同的形状.在北方的同学想将雪花收集起来,作为礼物送给在南方的同学们.一共有 n 个时刻,给出每个时刻下落雪花的形状,用不同的整数表示不同的形状.在收集的过程中,同学们不希望 ...

  6. Codeforces Round #394 (Div. 2) 颓废记

    昨天晚上(今天凌晨),又忍不住去打CF.(本蒟弱到只能打Div.2)... 我觉得我可以用一个词概括我这次的CF: 呵呵 刚一开赛,我就codeforces访问失败.. 后来好不容易能上了,两三分钟才 ...

  7. 【C++基础】形参实参

    c++规定:一个函数的默认实参既可以在定义中,也可在声明中指定,但在一个文件(准确的说,是一个作用域)中只能为一个形参指定默认实参一次

  8. Set_ML

    参考资料:斯坦福(http://cs231n.github.io/linear-classify/:http://cs231n.stanford.edu/slides/2017/) Mastering ...

  9. Hive操作笔记

    hive库清表,删除数据 insert overwrite table lorry.bigdata select * from lorry.bigdata where 1=0 hive的simple模 ...

  10. BZOJ3165:[HEOI2013]Segment

    浅谈标记永久化:https://www.cnblogs.com/AKMer/p/10137227.html 题目传送门:https://www.lydsy.com/JudgeOnline/proble ...