{"id":"4b584f88-ed82-4733-8ced-b78948f7e929","shortId":"dh5BtQ","kind":"skill","title":"Java Springboot","tagline":"Awesome Copilot skill by Github","description":"# Spring Boot Best Practices\n\nYour goal is to help me write high-quality Spring Boot applications by following established best practices.\n\n## Project Setup & Structure\n\n- **Build Tool:** Use Maven (`pom.xml`) or Gradle (`build.gradle`) for dependency management.\n- **Starters:** Use Spring Boot starters (e.g., `spring-boot-starter-web`, `spring-boot-starter-data-jpa`) to simplify dependency management.\n- **Package Structure:** Organize code by feature/domain (e.g., `com.example.app.order`, `com.example.app.user`) rather than by layer (e.g., `com.example.app.controller`, `com.example.app.service`).\n\n## Dependency Injection & Components\n\n- **Constructor Injection:** Always use constructor-based injection for required dependencies. This makes components easier to test and dependencies explicit.\n- **Immutability:** Declare dependency fields as `private final`.\n- **Component Stereotypes:** Use `@Component`, `@Service`, `@Repository`, and `@Controller`/`@RestController` annotations appropriately to define beans.\n\n## Configuration\n\n- **Externalized Configuration:** Use `application.yml` (or `application.properties`) for configuration. YAML is often preferred for its readability and hierarchical structure.\n- **Type-Safe Properties:** Use `@ConfigurationProperties` to bind configuration to strongly-typed Java objects.\n- **Profiles:** Use Spring Profiles (`application-dev.yml`, `application-prod.yml`) to manage environment-specific configurations.\n- **Secrets Management:** Do not hardcode secrets. Use environment variables, or a dedicated secret management tool like HashiCorp Vault or AWS Secrets Manager.\n\n## Web Layer (Controllers)\n\n- **RESTful APIs:** Design clear and consistent RESTful endpoints.\n- **DTOs (Data Transfer Objects):** Use DTOs to expose and consume data in the API layer. Do not expose JPA entities directly to the client.\n- **Validation:** Use Java Bean Validation (JSR 380) with annotations (`@Valid`, `@NotNull`, `@Size`) on DTOs to validate request payloads.\n- **Error Handling:** Implement a global exception handler using `@ControllerAdvice` and `@ExceptionHandler` to provide consistent error responses.\n\n## Service Layer\n\n- **Business Logic:** Encapsulate all business logic within `@Service` classes.\n- **Statelessness:** Services should be stateless.\n- **Transaction Management:** Use `@Transactional` on service methods to manage database transactions declaratively. Apply it at the most granular level necessary.\n\n## Data Layer (Repositories)\n\n- **Spring Data JPA:** Use Spring Data JPA repositories by extending `JpaRepository` or `CrudRepository` for standard database operations.\n- **Custom Queries:** For complex queries, use `@Query` or the JPA Criteria API.\n- **Projections:** Use DTO projections to fetch only the necessary data from the database.\n\n## Logging\n\n- **SLF4J:** Use the SLF4J API for logging.\n- **Logger Declaration:** `private static final Logger logger = LoggerFactory.getLogger(MyClass.class);`\n- **Parameterized Logging:** Use parameterized messages (`logger.info(\"Processing user {}...\", userId);`) instead of string concatenation to improve performance.\n\n## Testing\n\n- **Unit Tests:** Write unit tests for services and components using JUnit 5 and a mocking framework like Mockito.\n- **Integration Tests:** Use `@SpringBootTest` for integration tests that load the Spring application context.\n- **Test Slices:** Use test slice annotations like `@WebMvcTest` (for controllers) or `@DataJpaTest` (for repositories) to test specific parts of the application in isolation.\n- **Testcontainers:** Consider using Testcontainers for reliable integration tests with real databases, message brokers, etc.\n\n## Security\n\n- **Spring Security:** Use Spring Security for authentication and authorization.\n- **Password Encoding:** Always encode passwords using a strong hashing algorithm like BCrypt.\n- **Input Sanitization:** Prevent SQL injection by using Spring Data JPA or parameterized queries. Prevent Cross-Site Scripting (XSS) by properly encoding output.","tags":["java","springboot","awesome","copilot","github"],"capabilities":["skill","source-github","category-awesome-copilot"],"categories":["awesome-copilot"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/github/awesome-copilot/java-springboot","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"install_from":"skills.sh"}},"qualityScore":"0.300","qualityRationale":"deterministic score 0.30 from registry signals: · indexed on skills.sh · published under github/awesome-copilot","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill:v1","enrichmentVersion":1,"enrichedAt":"2026-04-22T19:40:24.915Z","embedding":null,"createdAt":"2026-04-18T20:24:42.194Z","updatedAt":"2026-04-22T19:40:24.915Z","lastSeenAt":"2026-04-22T19:40:24.915Z","tsv":"'380':234 '5':388 'algorithm':464 'alway':86,457 'annot':120,236,413 'api':197,217,329,348 'appli':290 'applic':24,406,428 'application-dev.yml':163 'application-prod.yml':164 'application.properties':131 'application.yml':129 'appropri':121 'authent':452 'author':454 'aw':190 'awesom':3 'base':90 'bcrypt':466 'bean':124,231 'best':10,28 'bind':151 'boot':9,23,47,52,57 'broker':443 'build':33 'build.gradle':40 'busi':264,268 'category-awesome-copilot' 'class':272 'clear':199 'client':227 'code':68 'com.example.app.controller':79 'com.example.app.order':72 'com.example.app.service':80 'com.example.app.user':73 'complex':321 'compon':83,97,111,114,385 'concaten':372 'configur':125,127,133,152,170 'configurationproperti':149 'consid':432 'consist':201,259 'constructor':84,89 'constructor-bas':88 'consum':213 'context':407 'control':118,195,417 'controlleradvic':254 'copilot':4 'criteria':328 'cross':482 'cross-sit':481 'crudrepositori':313 'custom':318 'data':59,205,214,298,302,306,339,475 'databas':287,316,342,441 'datajpatest':419 'declar':105,289,352 'dedic':182 'defin':123 'depend':42,63,81,94,102,106 'design':198 'direct':224 'dto':332 'dtos':204,209,241 'e.g':49,71,78 'easier':98 'encapsul':266 'encod':456,458,488 'endpoint':203 'entiti':223 'environ':168,178 'environment-specif':167 'error':246,260 'establish':27 'etc':444 'except':251 'exceptionhandl':256 'explicit':103 'expos':211,221 'extend':310 'extern':126 'feature/domain':70 'fetch':335 'field':107 'final':110,355 'follow':26 'framework':392 'github':7 'global':250 'goal':13 'gradl':39 'granular':295 'handl':247 'handler':252 'hardcod':175 'hash':463 'hashicorp':187 'help':16 'hierarch':142 'high':20 'high-qual':19 'immut':104 'implement':248 'improv':374 'inject':82,85,91,471 'input':467 'instead':369 'integr':395,400,437 'isol':430 'java':1,157,230 'jpa':60,222,303,307,327,476 'jparepositori':311 'jsr':233 'junit':387 'layer':77,194,218,263,299 'level':296 'like':186,393,414,465 'load':403 'log':343,350,361 'logger':351,356,357 'logger.info':365 'loggerfactory.getlogger':358 'logic':265,269 'make':96 'manag':43,64,166,172,184,192,279,286 'maven':36 'messag':364,442 'method':284 'mock':391 'mockito':394 'myclass.class':359 'necessari':297,338 'notnul':238 'object':158,207 'often':136 'oper':317 'organ':67 'output':489 'packag':65 'parameter':360,363,478 'part':425 'password':455,459 'payload':245 'perform':375 'pom.xml':37 'practic':11,29 'prefer':137 'prevent':469,480 'privat':109,353 'process':366 'profil':159,162 'project':30,330,333 'proper':487 'properti':147 'provid':258 'qualiti':21 'queri':319,322,324,479 'rather':74 'readabl':140 'real':440 'reliabl':436 'repositori':116,300,308,421 'request':244 'requir':93 'respons':261 'rest':196,202 'restcontrol':119 'safe':146 'sanit':468 'script':484 'secret':171,176,183,191 'secur':445,447,450 'servic':115,262,271,274,283,383 'setup':31 'simplifi':62 'site':483 'size':239 'skill':5 'slf4j':344,347 'slice':409,412 'source-github' 'specif':169,424 'spring':8,22,46,51,56,161,301,305,405,446,449,474 'spring-boot-starter-data-jpa':55 'spring-boot-starter-web':50 'springboot':2 'springboottest':398 'sql':470 'standard':315 'starter':44,48,53,58 'stateless':273,277 'static':354 'stereotyp':112 'string':371 'strong':155,462 'strongly-typ':154 'structur':32,66,143 'test':100,376,378,381,396,401,408,411,423,438 'testcontain':431,434 'tool':34,185 'transact':278,281,288 'transfer':206 'type':145,156 'type-saf':144 'unit':377,380 'use':35,45,87,113,128,148,160,177,208,229,253,280,304,323,331,345,362,386,397,410,433,448,460,473 'user':367 'userid':368 'valid':228,232,237,243 'variabl':179 'vault':188 'web':54,193 'webmvctest':415 'within':270 'write':18,379 'xss':485 'yaml':134","prices":[{"id":"13a18351-afde-40fc-ae6b-6f4bbe28b326","listingId":"4b584f88-ed82-4733-8ced-b78948f7e929","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"github","category":"awesome-copilot","install_from":"skills.sh"},"createdAt":"2026-04-18T20:24:42.194Z"}],"sources":[{"listingId":"4b584f88-ed82-4733-8ced-b78948f7e929","source":"github","sourceId":"github/awesome-copilot/java-springboot","sourceUrl":"https://github.com/github/awesome-copilot/tree/main/skills/java-springboot","isPrimary":false,"firstSeenAt":"2026-04-18T21:49:58.585Z","lastSeenAt":"2026-04-22T18:52:57.946Z"},{"listingId":"4b584f88-ed82-4733-8ced-b78948f7e929","source":"skills_sh","sourceId":"github/awesome-copilot/java-springboot","sourceUrl":"https://skills.sh/github/awesome-copilot/java-springboot","isPrimary":true,"firstSeenAt":"2026-04-18T20:24:42.194Z","lastSeenAt":"2026-04-22T19:40:24.915Z"}],"details":{"listingId":"4b584f88-ed82-4733-8ced-b78948f7e929","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"github","slug":"java-springboot","source":"skills_sh","category":"awesome-copilot","skills_sh_url":"https://skills.sh/github/awesome-copilot/java-springboot"},"updatedAt":"2026-04-22T19:40:24.915Z"}}