Skip to content

Commit

Permalink
feat: add spring pojo deserialize method (openGemini#129)
Browse files Browse the repository at this point in the history
Signed-off-by: weiping-code <[email protected]>
  • Loading branch information
weiping-code authored Sep 28, 2024
1 parent be50a4c commit 5a94a07
Show file tree
Hide file tree
Showing 10 changed files with 438 additions and 76 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.opengemini.client.spring.data.config;

import io.opengemini.client.spring.data.core.DefaultOpenGeminiSerializerFactory;
import io.opengemini.client.spring.data.core.OpenGeminiSerializerFactory;
import io.opengemini.client.spring.data.core.ReactiveOpenGeminiTemplate;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
Expand All @@ -17,4 +19,9 @@ public ReactiveOpenGeminiTemplate reactiveOpenGeminiTemplate() {
return new ReactiveOpenGeminiTemplate();
}

@Bean
@ConditionalOnMissingBean(name = "openGeminiSerializerFactory")
public OpenGeminiSerializerFactory openGeminiSerializerFactory() {
return new DefaultOpenGeminiSerializerFactory();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.opengemini.client.spring.data.config;

import io.opengemini.client.spring.data.core.OpenGeminiProperties;
import io.opengemini.client.spring.data.core.OpenGeminiSerializerFactory;
import io.opengemini.client.spring.data.core.ReactiveOpenGeminiTemplate;
import io.opengemini.client.spring.data.sample.TestReactiveApplication;
import org.junit.jupiter.api.Assertions;
Expand All @@ -19,6 +20,9 @@ public class OpenGeminiReactiveAutoConfigurationTest {
@Autowired
private ReactiveOpenGeminiTemplate reactiveOpenGeminiTemplate;

@Autowired
private OpenGeminiSerializerFactory openGeminiSerializerFactory;

@Test
public void properties_bean_should_be_declared() {
Assertions.assertNotNull(openGeminiProperties);
Expand All @@ -30,4 +34,9 @@ public void reactive_template_bean_should_be_declared() {
Assertions.assertNotNull(reactiveOpenGeminiTemplate);
}

@Test
public void serializerFactory_bean_should_be_declared() {
Assertions.assertNotNull(openGeminiSerializerFactory);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.opengemini.client.spring.data.config;

import io.opengemini.client.spring.data.core.DefaultOpenGeminiSerializerFactory;
import io.opengemini.client.spring.data.core.OpenGeminiProperties;
import io.opengemini.client.spring.data.core.OpenGeminiSerializerFactory;
import io.opengemini.client.spring.data.core.OpenGeminiTemplate;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
Expand All @@ -19,4 +21,10 @@ public OpenGeminiTemplate openGeminiTemplate() {
return new OpenGeminiTemplate();
}

@Bean
@ConditionalOnMissingBean(name = "openGeminiSerializerFactory")
public OpenGeminiSerializerFactory openGeminiSerializerFactory() {
return new DefaultOpenGeminiSerializerFactory();
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.opengemini.client.spring.data.config;

import io.opengemini.client.spring.data.core.OpenGeminiProperties;
import io.opengemini.client.spring.data.core.OpenGeminiSerializerFactory;
import io.opengemini.client.spring.data.core.OpenGeminiTemplate;
import io.opengemini.client.spring.data.sample.TestApplication;
import org.junit.jupiter.api.Assertions;
Expand All @@ -19,6 +20,9 @@ public class OpenGeminiAutoConfigurationTest {
@Autowired
private OpenGeminiTemplate openGeminiTemplate;

@Autowired
private OpenGeminiSerializerFactory openGeminiSerializerFactory;

@Test
public void properties_bean_should_be_declared() {
Assertions.assertNotNull(openGeminiProperties);
Expand All @@ -30,4 +34,9 @@ public void template_bean_should_be_declared() {
Assertions.assertNotNull(openGeminiTemplate);
}

@Test
public void serializerFactory_bean_should_be_declared() {
Assertions.assertNotNull(openGeminiSerializerFactory);
}

}
Loading

0 comments on commit 5a94a07

Please sign in to comment.