【Postopia Dev Log】Day 2

news/2024/10/6 3:21:38/文章来源:https://www.cnblogs.com/heslin/p/18288382

考虑到不确定能把系统做到什么程度,暂时不考虑分布式相关事宜

运行./gradlew bootRun 热加载不知道为什么没有生效,找来找去没找到原因
想直接用dokcer实现,不熟悉docker和docker compose困难重重
根据 SpringBoot DevTools Auto Restart and Live Reload 一顿操作之后控制台有反应了,但是没有效果
根据 LiveReload does not detect changes
”For a change to be noticeable it has to be compiled. You can learn more about this ~in the reference documentation~. We generally recommend using an IDE to both to run the application and to make changes. It will then compile the changes so that they can be noticed by DevTools.“
解决问题

进度:
完成注册,热加载

knowledge

UUID, Long ID comparison

UUID:

  • Globally unique
  • 128-bit value
  • String representation
  • No sequential ordering
  • Suitable for distributed systems
  • Can be generated without DB interaction
  • Larger storage size (typically 36 characters)
    ⠀Long ID:
  • Locally unique (per table)
  • 64-bit integer
  • Numeric representation
  • Sequential (if auto-incremented)
  • Simpler and more human-readable
  • Smaller storage size (8 bytes)
  • Typically faster for indexing and joining

@GeneratedValue

The @GeneratedValue annotation in Spring Boot is used to specify how the primary key should be generated for an entity. Here's a breakdown of its key aspects:
Common strategies:

  • GenerationType.AUTO (default)
  • GenerationType.IDENTITY
    • Pros: Simple, efficient for single-node systems
    • Cons: Can cause issues in distributed systems or data migrations
  • GenerationType.SEQUENCE
    • Pros: Efficient, works well in high-concurrency environments
    • Cons: Not supported by all databases (e.g., MySQL before 8.0)
  • GenerationType.TABLE
    • Pros: Database-independent, works everywhere
    • Cons: Potentially slower, requires extra table management
  • @NoArgsConstructor
  • @AllArgsConstructor
  • @RequiredArgsConstructor
    all final and @NonNull fields
  • @Builder
    used to generate a builder pattern for your class
MyClass myClass = MyClass.builder().name("John Doe").age(30).address("123 Main St").build();

./gradlew

This part of the command is invoking the Gradle Wrapper (gradlew or gradlew.bat), which is a script that comes bundled with the Gradle build tool. The Gradle Wrapper ensures that the correct version of Gradle is used for the project, regardless of whether or not the user has Gradle installed on their system.

Dockerfile

A Dockerfile is a script that contains a series of instructions on how to build a Docker image. Each instruction in a Dockerfile creates a layer in the image, and when you build the image, Docker executes these instructions step by step to produce the final image.
FROM
Specifies the base image to use for the Docker image you’re building. Every Dockerfile must start with a FROM instruction.
FROM ubuntu:20.04

LABEL
Adds metadata to the image, such as a maintainer name or a version.
LABEL maintainer="example@example.com"

RUN
Executes a command in the shell. It’s often used for installing software packages.
RUN apt-get update && apt-get install -y nginx

COPY
Copies files or directories from your local filesystem into the Docker image.
COPY ./localfile /containerfile

ADD
Similar to COPY, but also supports URL sources and automatic unpacking of compressed files.
ADD https://example.com/file.tar.gz /tmp/

WORKDIR
Sets the working directory for any subsequent RUN, CMD, ENTRYPOINT, COPY, and ADD instructions.
WORKDIR /app

CMD
Provides a command that will be executed when a container is started from the image. Only one CMD instruction is allowed per Dockerfile; if multiple CMD instructions are specified, only the last one takes effect.
CMD ["nginx", "-g", "daemon off;"]

ENTRYPOINT
Sets the default application to be used every time a container is created from the image. Unlike CMD, ENTRYPOINT won’t be overridden by command-line arguments.
ENTRYPOINT ["nginx", "-g", "daemon off;"]

ENV
Sets environment variables.
ENV MY_ENV_VAR=my_value

EXPOSE
Informs Docker that the container listens on the specified network ports at runtime. This doesn’t actually publish the port; it’s a form of documentation.
EXPOSE 80

VOLUME
Creates a mount point with the specified path and marks it as holding externally mounted volumes from the native host or other containers.
VOLUME ["/data"]

USER
Sets the user name or UID to use when running the image and for any RUN, CMD, and ENTRYPOINT instructions that follow it.
USER nginx

a project can have multiple Dockerfiles.
e.g.
├── Dockerfile # Default Dockerfile for production
├── Dockerfile.dev # Dockerfile for development
├── Dockerfile.test # Dockerfile for testing

Articles

Using Docker Compose with Spring Boot and PostgreSQL
SpringBoot DevTools Auto Restart and Live Reload

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/739735.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

mini-lsm通关笔记-字符相关操作

本文捋一下mini-lsm中的字符相关操作[u8] Vec<u8> Bytes Buf KeySlice KeyBytes[u8]和Vec<u8> 这两个是rust内置的数据类型。 [u8]: 切片本身并不拥有数据,而是引用了数据。它由一个指向数组开始处的指针和一个表示数组长度的计数器组成。[u8]类型通常写作&[u…

张高兴的 MicroPython 入门指南:(二)GPIO 的使用

目录什么是 GPIO使用方法使用微动开关点亮板载 LED硬件需求电路代码参考 什么是 GPIO GPIO 是 General Purpose Input Output 的缩写,即“通用输入输出”。 Raspberry Pi Pico 左右两侧各有一列 GPIO 引脚, Pico 通过这两列引脚进行一些硬件上的扩展,与传感器进行交互等等。…

MySQL-17.其他数据日志

C-17.其他数据日志 在之前的数据库事务的章节中,已经讲过,redo log和undo log。 对于线上数据库应用系统,突然遭遇数据库宕机怎么办?在这种情况下,定位宕机的原因就非常关键。我们可以查看数据库的错误日志。因为日志中记录了数据库运行中的诊断信息,包括了错误,警告和注…

如何恢复SSD NVME固态硬盘的数据恢复

一、使用数据恢复软件 操作步骤(以EaseUS Data Recovery Wizard为例): 安装软件:从EaseUS官网或其他可靠来源下载并安装EaseUS Data Recovery Wizard。 连接固态硬盘:将SSD NVMe固态硬盘连接到电脑上,并确保系统能够识别。 启动软件并选择恢复选项:打开EaseUS Data Reco…

raid5存储池已损毁硬盘数据

RAID 5存储池中的硬盘数据损毁是一个复杂的问题,因为它涉及到数据的冗余、存储方式以及恢复策略。 一、RAID 5的工作原理 RAID 5是一种使用条带化和奇偶校验技术的存储解决方案,它至少需要三个硬盘来构建。在这种配置中,数据和奇偶校验信息被分布在所有硬盘上,以提供数据冗…

SSD NVME固态 硬盘 数据恢复

SSD NVMe固态硬盘数据恢复是一个复杂但并非不可能的任务,以下是一些建议的方法和步骤: 一、了解数据恢复的基本原理 数据恢复的基本原理在于,即使文件在操作系统中被删除或格式化,其实际数据在硬盘的物理介质上可能仍然存在,只是被标记为可覆盖。 SSD NVMe固态硬盘与传统的…

磁盘阵列中raid5坏了一个硬盘数据恢复

RAID5数据恢复步骤包括备份数据、更换故障硬盘、重建RAID阵列和数据恢复注意事项。在恢复过程中,需遵循正确的步骤并保持冷静,不要尝试自行解决复杂的数据恢复问题,以免造成不可逆转的数据损失。完成恢复后,应进行完整性检查和验证。 一、概述 RAID 5是一种存储配置,它将多…

电脑开机检测不到硬盘怎么办 电脑检测不到硬盘问题解决

电脑开机检测不到硬盘,无法进入系统或者显示“Reboot and Select proper Boot device”等错误信息。这种情况可能会导致我们的数据丢失或者无法使用电脑。 一、电脑检测不到硬盘的可能原因 电脑检测不到硬盘的原因主要有以下几种:1、硬盘连接线松动或损坏:硬盘是通过SATA线或…

CentOS 7 下载 网络配置 ssh配置 JDK配置 Python3配置 Git配置 nvm配置 防火墙配置

背景 CentOS 8系统2021年12月31日已停止维护服务,CentOS 7系统将于2024年06月30日停止维护服务。CentOS官方不再提供CentOS 9及后续版本,不再支持新的软件和补丁更新。 所以我们如果要安装服务器操作系统就需要安装centos7。这里我是用虚拟机安装的centos7mini版,mini版本是…

IBM服务器raid1数据恢复

IBM服务器RAID1数据恢复是一个相对复杂的过程,因为RAID1涉及数据的镜像和冗余,但一旦数据丢失,恢复的可能性仍然存在。以下是一些建议的步骤和注意事项,以帮助您进行IBM服务器RAID1数据恢复: 一、停止使用受影响的服务器 一旦发现数据丢失,首要任务是停止使用受影响的服务…

服务器刷新BIOS后死机

服务器刷新BIOS后死机是一个比较常见的问题,可能由多种原因引起。 一、原因分析 BIOS文件问题: 刷新的BIOS文件可能本身就是坏的,或者与服务器硬件不兼容。 BIOS版本选择不当,也可能导致兼容性问题。 刷新过程问题: 刷新过程中突然断电或操作不当,可能导致BIOS损坏。 硬件…

其他计算机系统基础知识

计算机语言计算机语言是指用于人与计算机之间交流的一种语言,是人与计算机之间传递信息的媒介。计算机语言主要由一套指令组成,而这种指令一般包括表达式、流程控制和集合三大部分内容。表达式又包含变量、常量、字面量和运算符。 流程控制有分支、循环、函数和异常。 集合包…