微服务 SpringBoot 通过jdbcTemplate配置Oracle数据源

转自:http://www.cnblogs.com/yaohuiqin/p/9370153.html

1、引入jdbc支持,需要在pom.xml中添加依赖包:

1

2

3

4

5

6

7

8

9

10

11

    org.springframework.boot

    spring-boot-starter-jdbc

    com.oracle

    ojdbc6

    12.1.0.1-atlassian-hosted

2、在application.properties 文件中配置连接参数:

1

2

3

4

spring.datasource.url=jdbc:oracle:thin:@localhost:1521:orcl

spring.datasource.username=userstudy

spring.datasource.password=userstudy

spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver

 

3、添加Controller类、Service接口、ServiceImpl实现类

你可能感兴趣的:(Java开发)