首页 > 其他分享 >Springboot集成OceanBase4.x

Springboot集成OceanBase4.x

时间:2023-09-09 21:35:57浏览次数:34  
标签:集成 Springboot oceanbase testTableList tableDao test import com OceanBase4

概述

        在Springboot项目中使用Oceanbase4.2版本数据库。

pom

PS:可在maven仓库中搜索oceanbase,第一个就是。

<dependency>
	<groupId>com.oceanbase</groupId>
	<artifactId>oceanbase-client</artifactId>
	<version>2.4.4</version>
</dependency>

配置

spring:
  dataSource:
    driver-class-name: com.alipay.oceanbase.jdbc.Driver
    url: jdbc:oceanbase://192.169.1.200:2883/psm
    username: root@psm
    password: 123456

代码测试

package com.example.test_connect_oceanbase.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.test_connect_oceanbase.dao.Test_tableDao;
import com.example.test_connect_oceanbase.pojo.TEST_TABLE;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import javax.annotation.PostConstruct;
import java.util.List;

@Controller
@Slf4j
public class TestConnectController
{
    @Autowired
    Test_tableDao test_tableDao;

    @PostConstruct
    void initTask()
    {
        //查询当前
        List<TEST_TABLE> testTableList = test_tableDao.selectList(null);
        System.out.println( "before testTableList: \t" + testTableList );

        //新增一条记录
        TEST_TABLE testTable = new TEST_TABLE( 111, "new name" );

        QueryWrapper<TEST_TABLE> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq( "id", 111 );
        test_tableDao.delete( queryWrapper );

        test_tableDao.insert( testTable );

        //查询当前
        testTableList = test_tableDao.selectList(null);
        System.out.println( "after testTableList: \t" + testTableList );
    }
}

Springboot集成OceanBase4.x_oceanbase

标签:集成,Springboot,oceanbase,testTableList,tableDao,test,import,com,OceanBase4
From: https://blog.51cto.com/weiyuqingcheng/7420803

相关文章

  • 记一次SpringBoot Filter的过滤器被重复执行问题
    记一次SpringBootFilter的过滤器被重复执行问题debug发现过滤器执行两次,后来定位到WebFilter和Component注解导致多次扫描,而这次需要用到WebFilter,所以注掉了Component@Order(0)//@Component@WebFilter(urlPatterns={"/*"})@ConditionalOnProperty(name="color.trace.s......
  • hudi-0.12 编译与集成
    环境hadoop:2.7.2 hive:2.3.1 spark:2.4.4 flink:1.13.01.下载hudi源码包Indexof/dist/hudi/0.12.0(apache.org)  hudi-0.12.0.src.tgztar-zxfhudi-0.12.0.src.tgz-C/hadoop/app/2.安装maventar-zxf apache-maven-3.6.1.tar.gz配置settings<mirror> <id&g......
  • SpringBoot如何让业务Bean优先于其他Bean加载
    本博客原文地址:https://ntopic.cn/p/2023090901/源代码先行:Gitee本文介绍的完整仓库:https://gitee.com/obullxl/ntopic-bootGitHub本文介绍的完整仓库:https://github.com/obullxl/ntopic-boot背景介绍今天走读一个应用程序代码,发现一个有趣的现象:有多个不同的业务Bean中均......
  • Spring,SpringMVC,SpringBoot,SpringCloud有什么区别?
    讲一讲Spring、SpringMVC、SpringBoot、SpringCloud之间的关系?Spring是核心,提供了基础功能;SpringMVC是基于Spring的一个MVC框架;SpringBoot是为简化Spring配置的快速开发整合包;SpringCloud是构建在SpringBoot之上的服务治理框架。Spring一般说Spring框架指......
  • SpringBoot框架实现一个简单的管理系统
    当然,我可以提供一个简单的示例代码,用SpringBoot框架实现一个简单的管理系统。以下是一个用户管理系统的示例代码:创建SpringBoot项目:使用SpringInitializr(https://start.spring.io/)创建一个新的SpringBoot项目,选择相应的依赖(如SpringWeb、SpringDataJPA、Thymeleaf等)。创建......
  • springboot 框架国际化 + thymeleaf
    项目目录结构注意:导入thymeleaf,web的pom依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId></dependency><dependency> <groupId>org.springframework.boot&l......
  • 金蝶云星空与泛微OA集成的方案落地与实践
    打破信息孤岛,泛微OA集成的方案落地与实践在现代企业内部,不同类型的业务系统和泛微OA平台层出不穷。企业需要找到一种高效的方法来整合和协同这些多样化的系统,同时将它们与泛微OA平台融合,以实现资源整合和高度协同的办公环境。本文将深入探讨泛微OA集成的实际解决方案,借助金蝶云星......
  • 信管知识梳理(二)常规信息系统集成技术(网络协议、网络存储技术、网络工程、数据仓库和中
    一、网络标准与网络协议1.1OSI网络七层架构国际标准化组织(ISO)提出的网络体系结构模型,也叫做开发系统互连参考模型(OSI/RM),通常叫做OSI参考模型。如下图所示:物理层、数据链路层、网络层:统称为通信子网。是为了联网而附加的通信设备完成数据的传输功能。应用层、表示层、会......
  • AlterManager集成邮件、短信告警功能
    (文章目录)AlterManager集成邮件、短信告警功能前言在生产环境下,实时监控和报警是非常重要的,它可以快速发现问题并通知相关人员进行处理,避免事态进一步恶化。针对这一需求,我们可以使用AlterManager来集成邮件、短信告警功能。在本篇文章中,我们将会介绍如何使用AlterManager来集......
  • springboot打fat包怎么把第三方jar打入boot/lib中
    在maven工程的POM文件修改如下,在build部分: <resources><resource><directory>src/main/resources</directory></resource><resource><directory>../yhya-credibledata-collect-service/lib</directory>......