Giter VIP home page Giter VIP logo

atom's Introduction

Atom

Atom Jdk SpringBoot

Atom 是一个基于 SpringBoot 和 SpringCloud 的企业级常用组件封装库,提供了丰富的功能和强大的扩展性,可以帮助开发者快速构建高效、稳定的应用,简单实用,开箱即用!

版本

此分支基于 JDK17+,SpringBoot 3.x,SpringCloud 2022.x,SpringCloud Alibaba 2022.x开发。

各分支版本号对应关系如下:

Atom JDK SpringBoot SpringCloud SpringCloud Alibaba
2.0+ 17+ 3.0+ 2022.x 2022.x
1.0+ 8+ 2.7+ 2021.x 2021.x

模块

快速开始

在 pom.xml 中指定 parent

<!-- 指定parent -->
<parent>
	<groupId>net.wenzuo</groupId>
	<artifactId>atom</artifactId>
	<version>2.4.10</version>
	<relativePath/>
</parent>

根据需要的模块引入相关依赖

<!-- 按需引入相关模块 -->
<dependency>
	<groupId>net.wenzuo</groupId>
	<artifactId>modules...</artifactId>
</dependency>

配置项

各个模块的配置项,可以在 application.yml 中覆盖

atom:
  core:
    enabled: true # 是否启用core模块
    async: true # 是否启用异步处理
    json: true # 是否启用jackson处理
  doc:
    enabled: true # 是否启用doc模块
  jwt:
    enabled: true # 是否启用jwt模块
    secret: # JWT密钥, 可通过 net.wenzuo.atom.jwt.GenerateKey 生成随机密钥
  mqtt:
    enabled: true # 是否启用 MQTT 模块
    id: default # 实例 ID
    url: tcp://broker.emqx.io:1883 # 服务器地址
    username: # 服务器用户名
    password: # 服务器密码
    client-id: # 客户端 ID
    instances: # MQTT 多实例配置
      - id: emqx1 # 实例 ID
        enabled: true # 是否启用
        url: tcp://broker.emqx.io:1883 # 服务器地址
        username: # 服务器用户名
        password: # 服务器密码
        client-id: # 客户端 ID
  mybatis-plus:
    enabled: true # 是否启用mybatis-plus模块
    pagination: true # 是否启用mybatis-plus分页插件
    auto-fill: false # 是否启用创建时间,更新时间自动填充
    create-time-field: createTime # 创建时间字段名,此处为entity的属性名,非数据库字段名
    update-time-field: updateTime # 更新时间字段名,此处为entity的属性名,非数据库字段名
  opc:
    da:
      enabled: true # 是否启用 OPC DA 模块
      id: default # 实例 ID
      host: # 实例主机
      domain: # 实例域
      user:  # 实例用户
      password: # 实例密码
      prog-id: # 实例 ProgID
      cls-id: # 实例 ClsID
      period: 1000 # 刷新间隔
      async: true # 是否异步执行
      initialRefresh: false # 初始化获取全量数据, 仅在 async 为 true 时有效
      instances: # OPC DA 实例配置, 可以有多个
        - id: opcda1 # 实例 ID
          host: 127.0.0.1 # 实例主机
          domain: # 实例域
          user: opc # 实例用户
          password: opc123 # 实例密码
          prog-id: # 实例 ProgID
          cls-id: # 实例 ClsID
          period: 1000 # 刷新间隔
          async: true # 是否异步执行
          initialRefresh: false # 初始化获取全量数据, 仅在 async 为 true 时有效
  redis:
    enabled: true # 是否启用redis模块
    redis-template: true # 是否启用redisTemplate,启用后将自动配置RedisTemplate<String, Object>, 使用jackson序列化value
    cache-manager: true # 是否启用cacheManager,启用后将自动配置CacheManager, 使用jackson序列化value
  web:
    enabled: true # 是否启用web模块
    exception-handler: true # 是否启用异常拦截
    cors:
      enabled: true # 是否启用CORS
      configs: # CORS配置, 可配置多个
        - pattern: /**
          allow-credentials: true
          allowed-origins:
            - *
          allowed-origin-patterns:
          allowed-headers:
            - *
          allowed-methods:
            - *
          exposed-headers:
            - *
    logging:
      enabled: true # 是否启用请求响应日志记录
      include-path: # 包含路径
        - /**
      exclude-path: # 排除路径
  consul:
    enabled: true # 是否启用Consul模块
  feign:
    enabled: true # 是否启用Feign模块
    logging: true # 是否启用Feign的请求响应日志记录
    exception-handler: true # 是否启用Feign的异常处理,拦截第三方响应结果异常
    decode: true # 是否启用Feign的解码器, 解码响应结果,针对小于 400 的状态码抛出异常
  kafka:
    enabled: true # 是否启用Kafka模块

一些建议

  • 生产环境中在网关侧如果配置了CORS,建议关闭服务的CORS配置
  • 建议在生产环境关闭 doc 及其相关配置
knife4j:
  production: true
springdoc:
  api-docs:
    enabled: false
  swagger-ui:
    enabled: false

atom's People

Contributors

catch6 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.