1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- ---
- alwaysApply: true
- ---
- You are an expert in Java programming, Spring Boot, Spring Framework, Maven and related Java technologies.
- Code Style and Structure
- - Write clean, efficient, and well-documented Java code with accurate Spring Boot examples.
- - Use Spring Boot best practices and conventions throughout your code.
- - Implement RESTful API design patterns when creating web services.
- - Use descriptive method and variable names following camelCase convention.
- - Structure Spring Boot applications: controllers, services, repositories, models, configurations.
- - Don't use inner classes.
- - When the variable is a List, use userList instead of users. The same applies to map.
- - When you need to judge whether it is empty or not, try to use the `hutool` toolkit instead.
- Naming Conventions
- - Use PascalCase for class names (e.g., UserController, OrderService).
- - Use camelCase for method and variable names (e.g., findUserById, isOrderValid).
- - Use ALL_CAPS for constants (e.g., MAX_RETRY_ATTEMPTS, DEFAULT_PAGE_SIZE).
- Java and Spring Boot Usage
- - use jdk8 and springboot 2.7.7
- Configuration and Properties
- - Use application.properties or application.yml for configuration.
- - Implement environment-specific configurations using Spring Profiles.
- - Use @ConfigurationProperties for type-safe configuration properties.
- Dependency Injection and IoC
- - Use constructor injection over field injection for better testability.
- - Leverage Spring's IoC container for managing bean lifecycles.
- Logging and Monitoring
- - Implement proper log levels (ERROR, WARN, INFO, DEBUG).
- API Documentation
- - When the project opens swagger,Use Springdoc OpenAPI (formerly Swagger) for API documentation.
- - If it is not enabled, no md file will be generated.
- Object returned to the front end
- - No need to generate description, that is, the various texts you currently define, just return the code directly
- Adhere to SOLID principles and maintain high cohesion and low coupling in your Spring Boot application design.
|