a-pavithraa/springboot-skills-marketplace / plugins/springboot-architecture/skills/creating-springboot-projects
creating-springboot-projects
VerifiedUse when starting a new Spring Boot project or service: scaffolding or bootstrapping a backend, REST API, microservice or modular monolith; choosing how to structure it (layered, package-by-module, modular monolith, tomato, DDD-hexagonal); selecting Spring Boot 4 features; generating the base project with progen or Spring Initializr; or applying the bundled templates and references in this skill. Not for migrating existing projects or for isolated JPA/repository work without broader project-creation context.
assets/service-cqrs.java
View on GitHubpackage {{PACKAGE}}.{{MODULE}}.domain;
import {{PACKAGE}}.{{MODULE}}.domain.vo.*;
import {{PACKAGE}}.{{MODULE}}.domain.models.{{NAME}}VM;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* CQRS Service templates - separate write and read operations.
*
* {{NAME}}Service - Write operations (commands), @Transactional
* {{NAME}}QueryService - Read operations (queries), @Transactional(readOnly = true)
*/
// ============================================================
// WRITE SERVICE - Commands, state changes
// ------------------------------------------------------------
// NOTE: this bundle template shows two services in one file for
// readability. Java only allows one `public` top-level type per
// source file, so both services are package-private (no `public`
// modifier) — same convention as controller.java / repository.java.
// If you need them to be `public`, split each class into its own
// .java file before applying.
// ============================================================
@Service
@Transactional
class {{NAME}}Service {
private final {{NAME}}Repository repository;
private final ApplicationEventPublisher eventPublisher;
{{NAME}}Service({{NAME}}Repository repository, ApplicationEventPublisher eventPublisher) {
this.repository = repository;
this.eventPublisher = eventPublisher;
}
public {{NAME}}Code create(Create{{NAME}}Cmd cmd) {
var entity = {{NAME}}Entity.create(cmd.details());
repository.save(entity);
eventPublisher.publishEvent(new {{NAME}}Created(
entity.getCode().code(),
entity.getDetails().name()
));
return entity.getCode();
}
public void activate({{NAME}}Code code) {
var entity = repository.getByCode(code);
entity.activate();
repository.save(entity);
eventPublisher.publishEvent(new {{NAME}}Activated(code.code()));
}
public void deactivate({{NAME}}Code code) {
var entity = repository.getByCode(code);
entity.deactivate();
repository.save(entity);
}
}
// ============================================================
// READ SERVICE - Queries, no state changes
// ============================================================
@Service
@Transactional(readOnly = true)
class {{NAME}}QueryService {
private final {{NAME}}Repository repository;
private final {{NAME}}Mapper mapper;
{{NAME}}QueryService({{NAME}}Repository repository, {{NAME}}Mapper mapper) {
this.repository = repository;
this.mapper = mapper;
}
public List<{{NAME}}VM> findAll() {
return repository.findAll()
.stream()
.map(mapper::toVM)
.toList();
}
public List<{{NAME}}VM> findAllActive() {
return repository.findAllActive()
.stream()
.map(mapper::toVM)
.toList();
}
public {{NAME}}VM getByCode({{NAME}}Code code) {
var entity = repository.getByCode(code);
return mapper.toVM(entity);
}
}
// ============================================================
// MAPPER - Entity to ViewModel
// ============================================================
@Component
class {{NAME}}Mapper {
{{NAME}}VM toVM({{NAME}}Entity entity) {
return new {{NAME}}VM(
entity.getId().id(),
entity.getCode().code(),
entity.getDetails().name(),
entity.getDetails().description(),
entity.getStatus().name(),
entity.getCreatedAt(),
entity.getUpdatedAt()
);
}
}
// ============================================================
// COMMAND - Input for write operations
// ============================================================
// public record Create{{NAME}}Cmd(
// {{NAME}}Details details
// ) {}
// ============================================================
// VIEW MODEL - Output for read operations (primitives only)
// ============================================================
// public record {{NAME}}VM(
// Long id,
// String code,
// String name,
// String description,
// String status,
// Instant createdAt,
// Instant updatedAt
// ) {}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |