Skip to content

Commit

Permalink
🎉 release 0.0.01
Browse files Browse the repository at this point in the history
  • Loading branch information
weihubeats committed Mar 16, 2024
1 parent eef5a37 commit 10c993f
Show file tree
Hide file tree
Showing 15 changed files with 373 additions and 7 deletions.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
- [spring-boot-nebula-dependencies](spring-boot-nebula-dependencies) 统一依赖
- [spring-boot-nebula-samples](spring-boot-nebula-samples) 使用示例
- [spring-boot-nebula-web](spring-boot-nebula-web) web封装组件(包括统一异常返回,简化返回,自定义异常报警)
- [spring-boot-nebula-web-common](spring-boot-nebula-web-common) web模块基础工具类
- [spring-boot-nebula-distribute-lock](spring-boot-nebula-distribute-lock) 分布式锁




> 每个模块可单独引用使用,不耦合
Expand Down Expand Up @@ -76,4 +81,43 @@
public String test(@GetTimestamp LocalDateTime time) {
return time.toString();
}
```

# 依赖

- web
```xml

<dependency>
<groupId>io.github.weihubeats</groupId>
<artifactId>spring-boot-nebula-web</artifactId>
<version>0.0.01</version>
</dependency>
```

- 分布式锁
```xml
<dependency>
<groupId>io.github.weihubeats</groupId>
<artifactId>spring-boot-nebula-distribute-lock</artifactId>
<version>0.0.01</version>
</dependency>
```

- ddd聚合根组件
```xml
<dependency>
<groupId>io.github.weihubeats</groupId>
<artifactId>spring-boot-nebula-aggregate</artifactId>
<version>0.0.01</version>
</dependency>
```

- mybatis-plus
```xml
<dependency>
<groupId>io.github.weihubeats</groupId>
<artifactId>spring-boot-nebula-mybatis-plus</artifactId>
<version>0.0.01</version>
</dependency>
```
6 changes: 6 additions & 0 deletions spring-boot-nebula-aop-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@
</properties>

<dependencies>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down
152 changes: 152 additions & 0 deletions spring-boot-nebula-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@
<version>${revision}</version>
</dependency>

<dependency>
<groupId>io.github.weihubeats</groupId>
<artifactId>spring-boot-nebula-distribute-lock</artifactId>
<version>${revision}</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -107,5 +113,151 @@

</dependencyManagement>

<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<name>weihubeats</name>
<email>[email protected]</email>
<organization>https://weihubeats.blog.csdn.net/</organization>
</developer>
</developers>

<scm>
<connection>scm:[email protected]:weihubeats/spring-boot-common.git</connection>
<developerConnection>scm:[email protected]:weihubeats/spring-boot-common.git</developerConnection>
<url>[email protected]:weihubeats/spring-boot-common.git</url>
</scm>

<issueManagement>
<system>Github Issue</system>
<url>https://github.com/weihubeats/spring-boot-common/issues</url>
</issueManagement>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<inherited>true</inherited>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<inherited>true</inherited>
<configuration>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<!-- <skipTests>false</skipTests>-->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<!-- Javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
<additionalJOptions>
<additionalJOption>-Xdoclint:none</additionalJOption>
</additionalJOptions>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Gpg Signature -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>${flatten-maven-plugin.version}</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<distributionManagement>
<snapshotRepository>
<id>sonatype</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>sonatype</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>


</project>
2 changes: 1 addition & 1 deletion spring-boot-nebula-mybatis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>io.github.weihubeats</groupId>
<artifactId>spring-boot-nebula</artifactId>
<version>0.0.01</version>
<version>${revision}</version>
</parent>

<artifactId>spring-boot-nebula-mybatis</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions spring-boot-nebula-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
</parent>
<modules>
<module>spring-boot-nebula-web-sample</module>
<module>spring-boot-nebula-distribute-lock-sample</module>
</modules>

<modelVersion>4.0.0</modelVersion>
Expand All @@ -19,6 +20,7 @@
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.github.weihubeats</groupId>
<artifactId>spring-boot-nebula-samples</artifactId>
<version>${revision}</version>
</parent>

<artifactId>spring-boot-nebula-distribute-lock-sample</artifactId>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>io.github.weihubeats</groupId>
<artifactId>spring-boot-nebula-web</artifactId>
</dependency>

<dependency>
<groupId>io.github.weihubeats</groupId>
<artifactId>spring-boot-nebula-distribute-lock</artifactId>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GET localhost:8088/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.nebula.distribute.lock.sample;

import java.util.TimeZone;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
* Hello world!
*
*/
@SpringBootApplication
public class DistributeLockApplication {

public static void main(String[] args) {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
SpringApplication.run(DistributeLockApplication.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.nebula.distribute.lock.sample.config;

import com.nebula.base.utils.DataUtils;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.codec.JsonJacksonCodec;
import org.redisson.config.Config;
import org.redisson.config.SingleServerConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* @author : wh
* @date : 2024/3/16 11:02
* @description:
*/
@Configuration
public class RedissonConfig {

@Value("${redis.host}")
private String redisLoginHost;
@Value("${redis.port}")
private Integer redisLoginPort;
@Value("${redis.password}")
private String redisLoginPassword;


@Bean
public RedissonClient redissonClient() {
return createRedis(redisLoginHost, redisLoginPort, redisLoginPassword);
}

private RedissonClient createRedis(String redisHost, Integer redisPort, String redisPassword) {
Config config = new Config();
SingleServerConfig singleServerConfig = config.useSingleServer();
singleServerConfig.setAddress("redis://" + redisHost + ":" + redisPort + "");
singleServerConfig.setDatabase(1);
if (DataUtils.isNotEmpty(redisPassword)) {
singleServerConfig.setPassword(redisPassword);
}
config.setCodec(new JsonJacksonCodec());
return Redisson.create(config);
}
}
Loading

0 comments on commit 10c993f

Please sign in to comment.