<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brutus - Le Blog de Fabrice Bourqui &#187; Spring</title>
	<atom:link href="https://blog.developpez.com/brutus/pcategory/java/spring/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.developpez.com/brutus</link>
	<description></description>
	<lastBuildDate>Sat, 06 Apr 2013 02:02:25 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>Accès MySql via Spring et jndi, tomcat</title>
		<link>https://blog.developpez.com/brutus/p8932/java/acces_mysql_via_spring_et_jndi_tomcat</link>
		<comments>https://blog.developpez.com/brutus/p8932/java/acces_mysql_via_spring_et_jndi_tomcat#comments</comments>
		<pubDate>Mon, 24 May 2010 15:21:56 +0000</pubDate>
		<dc:creator><![CDATA[fabou3377]]></dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[1.Configuration Placer le jar de mysql dans le répertoire lib de tomcat 2.Dossier META-INF, context.xml de l&#8217;application &#60;?xml version=&#34;1.0&#34; encoding=&#34;UTF-8&#34;?&#62; &#60;Context antiJARLocking=&#34;true&#34; path=&#34;/myApp&#34;&#62; &#160; &#160; &#60;!-- Specify a JDBC datasource --&#62; &#160; &#160; &#60;Resource name=&#34;jdbc/dbmyapp&#34; auth=&#34;Container&#34; type=&#34;javax.sql.DataSource&#34; &#160; &#160; &#160; &#8230; <a href="https://blog.developpez.com/brutus/p8932/java/acces_mysql_via_spring_et_jndi_tomcat">Lire la suite <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><strong>1.Configuration</strong></p>
<p>Placer le jar de mysql dans le répertoire lib de tomcat</p>
<p><strong>2.Dossier META-INF, context.xml de l&rsquo;application</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; <br />
&lt;Context antiJARLocking=&quot;true&quot; path=&quot;/myApp&quot;&gt; <br />
&nbsp; &nbsp; &lt;!-- Specify a JDBC datasource --&gt; <br />
&nbsp; &nbsp; &lt;Resource name=&quot;jdbc/dbmyapp&quot; auth=&quot;Container&quot; type=&quot;javax.sql.DataSource&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp; username=&quot;user&quot; password=&quot;password&quot; driverClassName=&quot;com.mysql.jdbc.Driver&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp; url=&quot;jdbc:mysql://localhost:3306/database?autoReconnect=true&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp; validationQuery=&quot;select 1&quot; maxActive=&quot;10&quot; maxIdle=&quot;4&quot; /&gt; <br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp;&lt;!-- To work with the authentification --&gt; <br />
&nbsp; &nbsp;&lt;Realm className=&quot;org.apache.catalina.realm.DataSourceRealm&quot; <br />
&nbsp; &nbsp; dataSourceName=&quot;jdbc/database&quot; <br />
&nbsp; &nbsp; localDataSource=&quot;true&quot; <br />
&nbsp; &nbsp; roleNameCol=&quot;LB_ROLENAME&quot; <br />
&nbsp; &nbsp; userCredCol=&quot;LB_PASSWORD&quot; <br />
&nbsp; &nbsp; userNameCol=&quot;LB_USERNAME&quot; <br />
&nbsp; &nbsp; userRoleTable=&quot;T_ROLE&quot; <br />
&nbsp; &nbsp; userTable=&quot;T_USER&quot;/&gt; <br />
&lt;/Context&gt;</div></div>
<p><strong>3. applicationContext.xml</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; <br />
&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp;xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp;xmlns:aop=&quot;http://www.springframework.org/schema/aop&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp;xmlns:context=&quot;http://www.springframework.org/schema/context&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp;xmlns:flow=&quot;http://www.springframework.org/schema/webflow-config&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp;xmlns:jms=&quot;http://www.springframework.org/schema/jms&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp;xmlns:jee=&quot;http://www.springframework.org/schema/jee&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp;xmlns:lang=&quot;http://www.springframework.org/schema/lang&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp;xmlns:osgi=&quot;http://www.springframework.org/schema/osgi&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp;xmlns:tx=&quot;http://www.springframework.org/schema/tx&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp;xmlns:util=&quot;http://www.springframework.org/schema/util&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp;xmlns:p=&quot;http://www.springframework.org/schema/p&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp;xsi:schemaLocation=&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd <br />
&nbsp; &nbsp; &nbsp; &nbsp;http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd <br />
&nbsp; &nbsp; &nbsp; &nbsp;http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd <br />
&nbsp; &nbsp; &nbsp; &nbsp;http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-1.0.xsd <br />
&nbsp; &nbsp; &nbsp; &nbsp;http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-2.5.xsd <br />
&nbsp; &nbsp; &nbsp; &nbsp;http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd <br />
&nbsp; &nbsp; &nbsp; &nbsp;http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd <br />
&nbsp; &nbsp; &nbsp; &nbsp;http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd <br />
&nbsp; &nbsp; &nbsp; &nbsp;http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd <br />
&nbsp; &nbsp; &nbsp; &nbsp;http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd&quot;&gt; <br />
&nbsp; &nbsp; &lt;!--bean id=&quot;propertyConfigurer&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;org.springframework.beans.factory.config.PropertyPlaceholderConfigurer&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p:location=&quot;/WEB-INF/jdbc.properties&quot; /&gt; <br />
&nbsp;<br />
&nbsp; &nbsp; &lt;bean id=&quot;dataSource&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;org.springframework.jdbc.datasource.DriverManagerDataSource&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p:driverClassName=&quot;${jdbc.driverClassName}&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p:url=&quot;${jdbc.url}&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p:username=&quot;${jdbc.username}&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p:password=&quot;${jdbc.password}&quot; /--&gt; <br />
&nbsp;<br />
&nbsp;<br />
&nbsp; &nbsp; &lt;!-- JPA --&gt; <br />
&nbsp;<br />
&nbsp; &nbsp; &lt;tx:annotation-driven /&gt; <br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &lt;bean id=&quot;entityManagerFactory&quot; class=&quot;org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean&quot;&gt; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;dataSource&quot; ref=&quot;dataSource&quot; /&gt; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;jpaVendorAdapter&quot;&gt; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;bean class=&quot;org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter&quot;&gt; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;showSql&quot; value=&quot;true&quot; /&gt; &lt;!-- Prints used SQL to stdout --&gt; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;generateDdl&quot; value=&quot;true&quot; /&gt; &lt;!-- Generates tables. --&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;!-- &lt;property name=&quot;databasePlatform&quot; value=&quot;org.hibernate.dialect.MySQL5Dialect&quot; /&gt;--&gt; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;databasePlatform&quot; value=&quot;org.hibernate.dialect.MySQLInnoDBDialect&quot; /&gt; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/bean&gt; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/property&gt; <br />
&nbsp; &nbsp; &lt;/bean&gt; <br />
&nbsp; &nbsp; &lt;!-- <br />
&nbsp; &nbsp; &lt;bean id=&quot;dataSource&quot; class=&quot;com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource&quot; destroy-method=&quot;close&quot;&gt; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;url&quot; value=&quot;jdbc:mysql://localhost:3306/database&quot; /&gt; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;user&quot; value=&quot;username&quot; /&gt; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;password&quot; value=&quot;123456&quot; /&gt; <br />
&nbsp; &nbsp; &lt;/bean&gt; <br />
&nbsp; &nbsp; --&gt; <br />
&nbsp; &nbsp; &nbsp; &lt;!-- ###### JNDI Lookup ###### --&gt; <br />
&nbsp; &nbsp; &lt;bean id=&quot;dataSource&quot; class=&quot;org.springframework.jndi.JndiObjectFactoryBean&quot; lazy-init=&quot;true&quot;&gt; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;property name=&quot;jndiName&quot; value=&quot;java:comp/env/jdbc/dbmyapp&quot; /&gt; <br />
&nbsp; &nbsp; &lt;/bean&gt; <br />
&nbsp;<br />
&nbsp;<br />
&nbsp;<br />
&nbsp; &nbsp; &lt;bean id=&quot;transactionManager&quot; class=&quot;org.springframework.orm.jpa.JpaTransactionManager&quot;&gt; <br />
&nbsp; &nbsp; &lt;property name=&quot;entityManagerFactory&quot; ref=&quot;entityManagerFactory&quot;/&gt; <br />
&nbsp; &nbsp; &lt;property name=&quot;dataSource&quot; ref=&quot;dataSource&quot;/&gt; <br />
&nbsp; &lt;/bean&gt; <br />
&nbsp;<br />
&nbsp;<br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp; &lt;context:annotation-config/&gt; <br />
&nbsp; &nbsp; &lt;bean id=&quot;basicDao&quot; class=&quot;ch.devit.dao.service.BasicDao&quot; /&gt; <br />
&nbsp;<br />
&nbsp;<br />
&nbsp; &nbsp; &lt;bean id=&quot;surveyService&quot; class=&quot;ch.devit.dao.service.SurveyService&quot; <br />
&nbsp; &nbsp; p:basicDao-ref=&quot;basicDao&quot;/&gt; <br />
&nbsp;<br />
&nbsp; &nbsp; &lt;bean id=&quot;surveyController&quot; class=&quot;ch.devit.controller.SurveyController&quot; <br />
&nbsp; &nbsp; p:userService-ref=&quot;surveyService&quot; scope=&quot;prototype&quot; /&gt; <br />
&nbsp; &nbsp; &nbsp;<br />
&lt;/beans&gt;</div></div>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
