Week 6
January 6, 2025About 2 min
Week 6
General notice API
Write interface document
Read the API documentation and source code
Modify the source code to let users can customize the robot sender
Document security check API
Understand the API requirements and specifications
Write interface document
Develop the API for Word and Excel file security check by using Apache POI library
Generate test cases and implement the test cases
Reconstruct the code to reduce the complexity and satisfy the coding standard
Tecnical points
1. @NotNull annotation
- The @NotNull annotation is used to mark a parameter as not null. It is used to ensure that the parameter is not null before calling the method. If the parameter is null, an exception will be thrown.
2. @JsonProperty annotation
- The @JsonProperty annotation is used to map a field or a getter method to a JSON property. It is used to specify the JSON property name that should be used when serializing the object to JSON.
3. What is fallback routing?
- Fallback routing is a feature of Spring Cloud Gateway that allows you to define a fallback URI for a route. If the request to the primary URI fails, the request is then routed to the fallback URI.
4. What is StringJoiner class in Java?
- The StringJoiner class is used to concatenate strings in Java. It is a mutable class that can be used to build a string by adding individual strings or other objects. The StringJoiner class is useful when you need to concatenate a large number of strings into a single string. It was introduced in Java 1.8.
5. ComputeIfAbsent method
- If the key is not present in the map, the computeIfAbsent method is used to compute the value for that key and add it to the map. If the key is already present in the map, the existing value is returned.
6. AtomicInteger
- The AtomicInteger class is a wrapper class for an integer that is designed to be used in a multi-threaded environment. It provides atomic operations such as increment, decrement, and compareAndSet, which are used to safely update the value of the integer.
7. Record class in Java 14
- The Record class is a new feature in Java 14 that allows you to create immutable classes. It is similar to a data class, but it is more flexible and can have methods and constructors. It is a preview feature and is not available in all Java versions.
8. @ModelAttribute annotation
- The @ModelAttribute annotation is used to bind a method parameter to a model attribute in a Spring MVC controller. It is used to bind the value of a request parameter to a method parameter, which is then available in the controller method.
9. Considerations for Designing Database Tables:
- Always add comments for fields and tables.
- Use bigint unsigned for auto-increment primary keys.
Info
Reason: bigint unsigned ensures that the auto-increment primary key will not overflow and will not have negative values.
- Do not use timestamp, as it can only be used until the year 2038.
- Generally, avoid using large objects like text.