统一元数据管理的重要性
目前集群上总的数据量是多少?
集群上的每张表有几个分区?每一个分区所占大小?每一个分区有多少记录?
每张表有哪些字段?哪些字段使用比较热?热表?热字段?
表之间的血缘关系?表多是从其他表转换来的!java
步骤一:新建一个SpringBoot项目,先添加web依赖就能够了mysql
步骤二:获得的是一个maven项目,在pom文件中添加以下依赖,目的是确保能支持数据库访问层,即dao层的功能git
<!--添加Data的依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <!--添加MySQL驱动--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.47</version> </dependency> <!--添加lombok 插件 ,可选--> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency>
scala依赖以下:github
<scala.version>2.11.8</scala.version> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>${scala.version}</version> </dependency>
添加Scala的plugin:web
<!--添加Scala的plugin--> <plugin> <groupId>net.alchim31.maven</groupId> <artifactId>scala-maven-plugin</artifactId> <version>3.2.1</version> <executions> <execution> <id>compile-scala</id> <phase>compile</phase> <goals> <goal>add-source</goal> <goal>compile</goal> </goals> </execution> <execution> <id>test-compile-scala</id> <phase>test-compile</phase> <goals> <goal>add-source</goal> <goal>testCompile</goal> </goals> </execution> </executions> <configuration> <recompileMode>incremental</recompileMode> <scalaVersion>${scala.version}</scalaVersion> <args> <arg>-deprecation</arg> </args> <jvmArgs> <jvmArg>-Xms64m</jvmArg> <jvmArg>-Xmx1024m</jvmArg> </jvmArgs> </configuration> </plugin>
1.scala 的更多用法spring
@RequestMapping(value = Array("/table"),method = Array(RequestMethod.POST)) 说明:这个value的类型须要是 Array[String],包括method也是 class MetaTableController @Autowired()(metaTableService: MetaTableService) = {???} 说明:注入的方式比较不同 trait MetaTableRepository extends CrudRepository[MetaTable, Integer] {} 说明:定义接口使用trait 关键字,参数类型使用中括号[] ,不一样于Java的<>尖括号 接口实现一样使用extends 关键字,实现多个可使用with进行链接 ,with Serializable var id:Integer = _ javaBean实体类定义
导入starter-jar + mysql 依赖 spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://xxx:3306/bootscala?useUnicode=true&characterEncoding=UTF-8&useSSL=false spring.datasource.username=root spring.datasource.password=123456 ####### 添加jps相关配置 spring.jpa.hibernate.ddl-auto=update // 不用建立表,直接启动便可 spring.jpa.database=mysql ####### 实体类中 @Entity @Table @Id @GeneratedValue ####### 数据库访问层 public interface MetaDatabaseRepository extends CrudRepository<MetaDatabase,Integer> {}
springboot 测试用例简单编写
@RunWith(SpringRunner.class)
@SpringBootTest
@Testsql
更多能够去看看junit 相关知识数据库
项目位置:https://github.com/liuge36/boot2spark-project ,欢迎Star~
好的,到这里就结束了,有问题能够留言交流~springboot