-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eef5a37
commit 10c993f
Showing
15 changed files
with
373 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
spring-boot-nebula-samples/spring-boot-nebula-distribute-lock-sample/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
1 change: 1 addition & 0 deletions
1
...bula-samples/spring-boot-nebula-distribute-lock-sample/src/http/http-test-controller.http
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
GET localhost:8088/test |
18 changes: 18 additions & 0 deletions
18
...ock-sample/src/main/java/com/nebula/distribute/lock/sample/DistributeLockApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...te-lock-sample/src/main/java/com/nebula/distribute/lock/sample/config/RedissonConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
Oops, something went wrong.