diff --git a/pom.xml b/pom.xml
index 8719134..8e2b4db 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,6 +4,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
+
+ 2.7.1
+ spring-boot-starter-parent
+ org.springframework.boot
+
+
cn.zzzykj
zy-short-url
pom
@@ -12,6 +18,7 @@
zy-shorturl-core
zy-shorturl-spring-boot-starter
zy-shorturl-store
+ zu-shorturl-web
diff --git a/zu-shorturl-web/pom.xml b/zu-shorturl-web/pom.xml
new file mode 100644
index 0000000..dd84414
--- /dev/null
+++ b/zu-shorturl-web/pom.xml
@@ -0,0 +1,48 @@
+
+
+
+ zy-short-url
+ cn.zzzykj
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ zu-shorturl-web
+
+
+ 8
+ 8
+
+
+
+
+
+ cn.zzzykj
+ zy-short-url-spring-boot-starter
+ 1.0-SNAPSHOT
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+
+
+ org.springframework.boot
+ spring-boot-autoconfigure
+
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+
\ No newline at end of file
diff --git a/zu-shorturl-web/src/main/java/cn/shorturl/web/Application.java b/zu-shorturl-web/src/main/java/cn/shorturl/web/Application.java
new file mode 100644
index 0000000..01f1d46
--- /dev/null
+++ b/zu-shorturl-web/src/main/java/cn/shorturl/web/Application.java
@@ -0,0 +1,18 @@
+package cn.shorturl.web;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @author ZhuoQinghui
+ * @version 1.0.0
+ * Create By 2022/7/31 16:15
+ */
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
diff --git a/zu-shorturl-web/src/main/java/cn/shorturl/web/controller/ShortUrlController.java b/zu-shorturl-web/src/main/java/cn/shorturl/web/controller/ShortUrlController.java
new file mode 100644
index 0000000..602e633
--- /dev/null
+++ b/zu-shorturl-web/src/main/java/cn/shorturl/web/controller/ShortUrlController.java
@@ -0,0 +1,40 @@
+package cn.shorturl.web.controller;
+
+import cn.shorturl.core.ShortUrlConfig;
+import cn.shorturl.store.ShortUrlStore;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+
+/**
+ * @author ZhuoQinghui
+ * @version 1.0.0
+ * Create By 2022/7/31 16:41
+ */
+@Slf4j
+@RestController
+@RequestMapping("/su")
+public class ShortUrlController {
+
+ @Resource
+ private ShortUrlConfig shortUrlConfig;
+
+ @Resource
+ private ShortUrlStore store;
+
+ @PostConstruct
+ public void init() {
+ log.info("shortUrlConfig: {}", shortUrlConfig);
+ log.info("store: {}", store);
+ }
+
+ @GetMapping("/gen")
+ public String gen() {
+ return "";
+ }
+
+}
diff --git a/zu-shorturl-web/src/main/resources/application.yml b/zu-shorturl-web/src/main/resources/application.yml
new file mode 100644
index 0000000..4bb0b58
--- /dev/null
+++ b/zu-shorturl-web/src/main/resources/application.yml
@@ -0,0 +1,7 @@
+server:
+ port: 8090
+
+shorturl:
+ store:
+ retryMax: 6
+ store-type: redis
\ No newline at end of file
diff --git a/zy-shorturl-spring-boot-starter/pom.xml b/zy-shorturl-spring-boot-starter/pom.xml
index 90cf7e5..94ea361 100644
--- a/zy-shorturl-spring-boot-starter/pom.xml
+++ b/zy-shorturl-spring-boot-starter/pom.xml
@@ -17,4 +17,32 @@
UTF-8
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+
+
+
+ cn.zzzykj
+ zy-shorturl-store
+ 1.0-SNAPSHOT
+ compile
+
+
+
+
+ org.projectlombok
+ lombok
+ true
+ compile
+
+
+
+
\ No newline at end of file
diff --git a/zy-shorturl-spring-boot-starter/src/main/java/cn/shorturl/boot/starter/ShortUrlAutoConfiguration.java b/zy-shorturl-spring-boot-starter/src/main/java/cn/shorturl/boot/starter/ShortUrlAutoConfiguration.java
new file mode 100644
index 0000000..277708c
--- /dev/null
+++ b/zy-shorturl-spring-boot-starter/src/main/java/cn/shorturl/boot/starter/ShortUrlAutoConfiguration.java
@@ -0,0 +1,50 @@
+package cn.shorturl.boot.starter;
+
+import cn.shorturl.core.ShortUrlConfig;
+import cn.shorturl.core.ShortUrlUtil;
+import cn.shorturl.store.ShortUrlStore;
+import cn.shorturl.store.store.RedisShortUrlStore;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+
+import javax.annotation.PostConstruct;
+
+/**
+ * @author ZhuoQinghui
+ * @version 1.0.0
+ * Create By 2022/7/31 16:25
+ */
+@Slf4j
+@Configuration
+@EnableConfigurationProperties
+public class ShortUrlAutoConfiguration {
+
+ @Bean
+ @ConditionalOnMissingBean(ShortUrlConfig.class)
+ @ConfigurationProperties(prefix = "shorturl.store")
+ public ShortUrlConfig shortUrlConfig() {
+ return new ShortUrlConfig();
+ }
+
+ @Bean
+ @ConditionalOnBean(ShortUrlConfig.class)
+ public ShortUrlUtil shortUrlUtil(ShortUrlConfig config) {
+ return new ShortUrlUtil(config);
+ }
+
+ @Bean
+ @ConditionalOnMissingBean(ShortUrlStore.class)
+ @ConditionalOnProperty(prefix = "shorturl.store", name = "store-type", havingValue = "redis")
+ public ShortUrlStore redisShortUrlStore() {
+ log.info("use short-url store: {}", RedisShortUrlStore.class.getName());
+ return new RedisShortUrlStore();
+ }
+
+}
diff --git a/zy-shorturl-spring-boot-starter/src/main/resources/META-INF/spring.factories b/zy-shorturl-spring-boot-starter/src/main/resources/META-INF/spring.factories
new file mode 100644
index 0000000..549488a
--- /dev/null
+++ b/zy-shorturl-spring-boot-starter/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,2 @@
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+ cn.shorturl.boot.starter.ShortUrlAutoConfiguration
\ No newline at end of file
diff --git a/zy-shorturl-store/pom.xml b/zy-shorturl-store/pom.xml
index 8e4ed1a..ae03c0e 100644
--- a/zy-shorturl-store/pom.xml
+++ b/zy-shorturl-store/pom.xml
@@ -23,20 +23,6 @@
zy-short-url-core
1.0-SNAPSHOT
-
- org.springframework.boot
- spring-boot-starter
- 2.7.2
- compile
- true
-
-
- org.springframework.boot
- spring-boot-starter-data-redis-reactive
- 2.7.2
- compile
- true
-
\ No newline at end of file
diff --git a/zy-shorturl-store/src/main/java/cn/shorturl/store/config/BeanRegister.java b/zy-shorturl-store/src/main/java/cn/shorturl/store/config/BeanRegister.java
deleted file mode 100644
index d24be4c..0000000
--- a/zy-shorturl-store/src/main/java/cn/shorturl/store/config/BeanRegister.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package cn.shorturl.store.config;
-
-import cn.shorturl.core.ShortUrlConfig;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * @author Lenovo
- */
-@Configuration
-@EnableConfigurationProperties
-@ComponentScan(basePackages = "cn.shorturl.store")
-public class BeanRegister {
-
- @ConfigurationProperties(prefix = "shorturl.store")
- public ShortUrlConfig shortUrlConfig(ShortUrlConfig shortUrlConfig) {
- return shortUrlConfig;
- }
-
-}
diff --git a/zy-shorturl-store/src/main/java/cn/shorturl/store/store/RedisShortUrlStore.java b/zy-shorturl-store/src/main/java/cn/shorturl/store/store/RedisShortUrlStore.java
index 683b3b3..8446831 100644
--- a/zy-shorturl-store/src/main/java/cn/shorturl/store/store/RedisShortUrlStore.java
+++ b/zy-shorturl-store/src/main/java/cn/shorturl/store/store/RedisShortUrlStore.java
@@ -3,21 +3,12 @@ package cn.shorturl.store.store;
import cn.shorturl.core.ShortUrl;
import cn.shorturl.core.ShortUrlConfig;
import cn.shorturl.store.ShortUrlStore;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-
-import javax.annotation.PostConstruct;
/**
* @author Lenovo
*/
-@ConditionalOnProperty(prefix = "shorturl.store", name = "storeType", havingValue = "redis")
public class RedisShortUrlStore implements ShortUrlStore {
- @PostConstruct
- public void init() {
- System.out.println("RedisShortUrlStore init");
- }
-
@Override
public ShortUrl add(ShortUrl shortUrl) {
return null;