Are you an LLM? You can read better optimized documentation at /guide/extensions/cosid-spring-boot-starter.md for this page in Markdown format
CosId-Spring-Boot-Starter Module
The Spring-Boot-Starter module integrates all CosId extensions and provides auto-configuration capabilities, making the CosId framework more convenient to use in Spring Boot projects.
TIP
For the configuration documentation of this module, please refer to Configuration.
Installation
kotlin
val cosidVersion = "latestVersion"
implementation("me.ahoo.cosid:cosid-spring-boot-starter:${cosidVersion}")xml
<dependencies>
<dependency>
<groupId>me.ahoo.cosid</groupId>
<artifactId>cosid-spring-boot-starter</artifactId>
<version>${cosid.version}</version>
</dependency>
</dependencies>Actuator
The CosId-Spring-Boot-Starter module provides actuator support, allowing you to view the CosId status through actuator endpoints.

CosIdEndpoint
Used to view the status information of all defined ID generators.
shell
curl -X GET "http://localhost:8080/actuator/cosid" -H "accept: */*"json
{
"cosid": {
"kind": "ClockSyncCosIdGenerator",
"actual": {
"kind": "Radix62CosIdGenerator",
"machineId": 252,
"lastTimestamp": 1704183358593,
"converter": {
"kind": "RadixCosIdStateParser",
"actual": null
}
},
"converter": {
"kind": "RadixCosIdStateParser",
"actual": null
}
},
"user": {
"kind": "StringSegmentId",
"actual": {
"kind": "SegmentChainId",
"fetchTime": 1703401907,
"maxId": 91658,
"offset": 91638,
"sequence": 91638,
"step": 20,
"isExpired": false,
"isOverflow": false,
"isAvailable": true,
"converter": {
"kind": "Radix62IdConverter",
"radix": 62,
"charSize": 11,
"padStart": true,
"maxId": 9223372036854776000
}
},
"converter": {
"kind": "Radix62IdConverter",
"radix": 62,
"charSize": 6,
"padStart": true,
"maxId": 56800235584
}
}
}CosIdGeneratorEndpoint
Provides an API interface for generating long type IDs.
CosIdStringGeneratorEndpoint
Provides an API interface for generating string type IDs.
Configuration
yaml
management:
endpoints:
web:
exposure:
include:
- cosid
- cosidGenerator
- cosidStringGenerator