1、首先打开电脑检查网络。
2、其次打开springboot进行测试网络连接是否异常。
3、最后等待网络连接正常后,将springboot和阿里云数据库重新连接,即可读取数据。
1.在application.properties配置账号密码等信息
server.port=8080
server.servlet.context-path=/share-center-report
spring.thymeleaf.prefix=classpath:/templates/
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.druid.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.url=
spring.datasource.username=
spring.datasource.password=
2.引入依赖
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.1</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.10</version>
</dependency>
3.在启动类配置扫描mapper
@MapperScan({"com.example.demo1.mapper"})
4.编写demo测试
public interface testMapper {
@Select("select * from test_data")
List<TestVo>test()
}
/ 自定义realm程序 /
public class MyRealm extends AuthorizingRealm{
@Resource
private testMapper testMapper
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
System.out.println("授权")
return null
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)