To use the unique-client-spring-boot-starter
module, you need to include the unique-client-spring-boot-starter-0.1.0.jar
file and its dependencies in the classpath.
If you are using Maven just add the following dependency to your pom.xml:
<dependency>
<groupId>io.leego</groupId>
<artifactId>unique-client-spring-boot-starter</artifactId>
<version>0.1.0</version>
</dependency>
Property | Description |
---|---|
spring.unique.enabled | Whether to enable auto-configure. |
spring.unique.uri | The absolute URL or resolvable hostname (the protocol is optional). |
spring.unique.service-id | The name of the service with optional protocol prefix. |
spring.unique.timeout | Request timeout. |
spring.unique.cache.enabled | Whether to enable caching. |
spring.unique.cache.size | Cache size. |
spring.unique.hystrix.enabled | Whether to enable Hystrix . |
spring.unique.mybatis.plugin.enabled | Whether to enable mybatis-plugin. |
spring.unique.validation.enabled | Whether to enable validation. |
spring.unique.validation.keys | Keys to be validated. |
Assume there is a sequence service running {host: localhost, port: 8080}.
Properties
spring.unique.enabled=true
spring.unique.uri=https://localhost:8080
Yaml
spring:
unique:
enabled: true
uri: https://localhost:8080
Assume there is a registered sequence service named sequence
.
Properties
spring.unique.enabled=true
spring.unique.service-id=sequence
Yaml
spring:
unique:
enabled: true
service-id: sequence
See the unique-client for details.
Obtain one sequence named test-key
.
@Service
public class Tests {
@Autowired
private UniqueClient client;
public void test() {
long value = client.next("test-key");
System.out.println(value);
}
}
See the unique-mybatis-support for details.
You need to include the unique-mybatis-support-0.1.0.jar
file.
<dependency>
<groupId>io.leego</groupId>
<artifactId>unique-mybatis-support</artifactId>
<version>0.1.0</version>
</dependency>
Properties
spring.unique.mybatis.plugin.enabled=true
Yaml
spring:
unique:
mybatis:
plugin:
enabled: true