Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Describes Spring Boot architecture, REST API design, layered services, data access, caching, async and logging patterns for Java backends.
75% 83%+8 ptsof test cases passed
Passed 20 of 24 test cases with the skill, and 18 of 24 without it.
3 of 3 safety checks passed
Not used yet
为构建可扩展的生产级服务提供的 Spring Boot 架构与 API 模式。
@RestController
@RequestMapping("/api/markets")
@Validated
class MarketController {
private final MarketService marketService;
MarketController(MarketService marketService) {
this.marketService = marketService;
}
@GetMapping
ResponseEntity<Page<MarketResponse>> list(
@RequestParam(defaultValue = "0") int page,
@RequestParam(defaultValue = "20") int size) {
Page<Market> markets = marketService.list(PageRequest.of(page, size));
return ResponseEntity.ok(markets.map(MarketResponse::from));
}
@PostMapping
ResponseEntity<MarketResponse> create(@Valid @RequestBody CreateMarketRequest request) {
Market market = marketService.create(request);
return ResponseEntity.status(HttpStatus.CREATED).body(MarketResponse::from(market));
}
}
public interface MarketRepository extends JpaRepository<MarketEntity, Long> {
@Query("select m from MarketEntity m where m.status = :status order by m.volume desc")
List<MarketEntity> findActive(@Param("status") MarketStatus status, Pageable pageable);
}
Published skills whose descriptions closely match this one, with their benchmark result.
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.