parent
2b62897dc5
commit
b232aefdeb
|
@ -339,7 +339,7 @@ Kotlin::
|
||||||
|
|
||||||
More sophisticated stored procedure support is xref:data-access/jdbc/object.adoc#jdbc-StoredProcedure[covered later].
|
More sophisticated stored procedure support is xref:data-access/jdbc/object.adoc#jdbc-StoredProcedure[covered later].
|
||||||
|
|
||||||
[[jdbc-JdbcTemplate-idioms]]
|
[[jdbc-jdbctemplate-idioms]]
|
||||||
=== `JdbcTemplate` Best Practices
|
=== `JdbcTemplate` Best Practices
|
||||||
|
|
||||||
Instances of the `JdbcTemplate` class are thread-safe, once configured. This is
|
Instances of the `JdbcTemplate` class are thread-safe, once configured. This is
|
||||||
|
@ -605,7 +605,7 @@ functionality that is present only in the `JdbcTemplate` class, you can use the
|
||||||
`getJdbcOperations()` method to access the wrapped `JdbcTemplate` through the
|
`getJdbcOperations()` method to access the wrapped `JdbcTemplate` through the
|
||||||
`JdbcOperations` interface.
|
`JdbcOperations` interface.
|
||||||
|
|
||||||
See also xref:data-access/jdbc/core.adoc#jdbc-JdbcTemplate-idioms[`JdbcTemplate` Best Practices]
|
See also xref:data-access/jdbc/core.adoc#jdbc-jdbctemplate-idioms[`JdbcTemplate` Best Practices]
|
||||||
for guidelines on using the `NamedParameterJdbcTemplate` class in the context of an application.
|
for guidelines on using the `NamedParameterJdbcTemplate` class in the context of an application.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.docs.dataaccess.jdbc.jdbcJdbcTemplateidioms;
|
package org.springframework.docs.dataaccess.jdbc.jdbcjdbctemplateidioms;
|
||||||
|
|
||||||
public interface CorporateEventDao {
|
public interface CorporateEventDao {
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.docs.dataaccess.jdbc.jdbcJdbcTemplateidioms;
|
package org.springframework.docs.dataaccess.jdbc.jdbcjdbctemplateidioms;
|
||||||
|
|
||||||
public interface CorporateEventRepository {
|
public interface CorporateEventRepository {
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.docs.dataaccess.jdbc.jdbcJdbcTemplateidioms;
|
package org.springframework.docs.dataaccess.jdbc.jdbcjdbctemplateidioms;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.springframework.docs.dataaccess.jdbc.jdbcJdbcTemplateidioms;
|
package org.springframework.docs.dataaccess.jdbc.jdbcjdbctemplateidioms;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.docs.dataaccess.jdbc.jdbcJdbcTemplateidioms;
|
package org.springframework.docs.dataaccess.jdbc.jdbcjdbctemplateidioms;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.springframework.docs.dataaccess.jdbc.jdbcJdbcTemplateidioms;
|
package org.springframework.docs.dataaccess.jdbc.jdbcjdbctemplateidioms;
|
||||||
|
|
||||||
import org.apache.commons.dbcp2.BasicDataSource;
|
import org.apache.commons.dbcp2.BasicDataSource;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.docs.dataaccess.jdbc.jdbcJdbcTemplateidioms
|
package org.springframework.docs.dataaccess.jdbc.jdbcjdbctemplateidioms
|
||||||
|
|
||||||
import org.apache.commons.dbcp2.BasicDataSource
|
import org.apache.commons.dbcp2.BasicDataSource
|
||||||
import org.springframework.context.annotation.Bean
|
import org.springframework.context.annotation.Bean
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.docs.dataaccess.jdbc.jdbcJdbcTemplateidioms
|
package org.springframework.docs.dataaccess.jdbc.jdbcjdbctemplateidioms
|
||||||
|
|
||||||
import org.apache.commons.dbcp2.BasicDataSource
|
import org.apache.commons.dbcp2.BasicDataSource
|
||||||
import org.springframework.context.annotation.Bean
|
import org.springframework.context.annotation.Bean
|
|
@ -9,7 +9,7 @@
|
||||||
https://www.springframework.org/schema/context/spring-context.xsd">
|
https://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
|
||||||
<!-- tag::snippet[] -->
|
<!-- tag::snippet[] -->
|
||||||
<bean id="corporateEventDao" class="org.springframework.docs.dataaccess.jdbc.jdbcJdbcTemplateidioms.JdbcCorporateEventDao">
|
<bean id="corporateEventDao" class="org.springframework.docs.dataaccess.jdbc.jdbcjdbctemplateidioms.JdbcCorporateEventDao">
|
||||||
<property name="dataSource" ref="dataSource"/>
|
<property name="dataSource" ref="dataSource"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<!-- tag::snippet[] -->
|
<!-- tag::snippet[] -->
|
||||||
<!-- Scans within the base package of the application for @Component classes to configure as beans -->
|
<!-- Scans within the base package of the application for @Component classes to configure as beans -->
|
||||||
<context:component-scan base-package="org.springframework.docs.dataaccess.jdbc.jdbcJdbcTemplateidioms" />
|
<context:component-scan base-package="org.springframework.docs.dataaccess.jdbc.jdbcjdbctemplateidioms" />
|
||||||
|
|
||||||
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
|
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
|
||||||
<property name="driverClassName" value="${jdbc.driverClassName}"/>
|
<property name="driverClassName" value="${jdbc.driverClassName}"/>
|
Loading…
Reference in New Issue