CS Framework is a customizable and modular Java framework built on the Spring framework. It simplifies common operations like caching, database connectivity, and email sending by providing easy-to-use annotations and configurable properties. This README provides an overview of the three core modules in CS Framework: Cache, DataSource, and Email.
The Cache module in CS Framework leverages Infinispan to provide a flexible caching solution for applications. It allows developers to easily configure and use different cache configurations, such as long-term, medium-term, and short-term caches, each with its own Time-To-Live (TTL) settings.
- Annotate your application with
@EnableCSCache
to enable caching configuration. - Use the provided cache names (
longterm-cache
,mediumterm-cache
,shortterm-cache
) in your application to utilize specific cache configurations. - Implement caching in your code using Spring's
@Cacheable
annotation and referencing the configured cache names.
- Improves application performance by caching frequently accessed data.
- Configurable cache settings cater to various use cases with different TTLs.
- Enhances code readability and maintainability by centralizing caching configurations.
- Add the
@EnableCSCache
annotation to your main application class. - Use the provided cache names in your code with the
@Cacheable
annotation. - Customize caching behavior by adjusting TTLs in the CacheConfig class.
The DataSource module simplifies database connectivity in CS Framework by providing configurations for H2, MSSQL, and Oracle databases. It supports dynamic switching between different database implementations through YAML configuration.
- Annotate your application with
@EnableCSDataSource
to enable data source configuration. - Specify the desired database type in the YAML configuration (
cs.datasource.type
) to dynamically switch between H2, MSSQL, and Oracle.
- Streamlines database connectivity with multiple implementations (H2, MSSQL, Oracle).
- Provides flexibility to switch databases dynamically based on application requirements.
- Promotes clean code by separating data source configurations from application logic.
- Add the
@EnableCSDataSource
annotation to your main application class. - Specify the desired database type in the YAML configuration (
cs.datasource.type
). - Customize database-specific properties in the respective configuration classes.
The Email module facilitates email sending in CS Framework by configuring JavaMailSender through a straightforward EmailConfig class. It simplifies email properties management and promotes clean email sending code.
- Annotate your application with
@EnableCSEmail
to enable email configuration. - Customize email properties in the
application.yml
file under thecs.email
prefix.
- Simplifies email configuration and sending in Java applications.
- Improves maintainability by centralizing email configuration in one place.
- Enhances code readability with clean and concise email sending code.
- Add the
@EnableCSEmail
annotation to your main application class. - Customize email properties in the
application.yml
file under thecs.email
prefix. - Inject the configured
JavaMailSender
bean into your services or controllers for sending emails.