https://github.com/chrimle/spring-boot-static-property-injector
Inject Spring Boot Properties into static fields!
https://github.com/chrimle/spring-boot-static-property-injector
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.8%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Inject Spring Boot Properties into static fields!
Basic Info
- Host: GitHub
- Owner: Chrimle
- License: apache-2.0
- Language: Java
- Default Branch: main
- Homepage: https://chrimle.github.io/spring-boot-static-property-injector/
- Size: 76.2 KB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 2
Topics
Metadata Files
README.md
Spring Boot Static Property Injector
If you find this project useful, please ⭐ Star ⭐ it and share it with others! This is the best way to show appreciation for this project - Thank you! ❤️
Purpose
Load Spring Boot properties (as SpEL
and/or Spring Property Placeholders e.g. @Value-annotation)
to static fields!
JavaDoc
The official JavaDoc hosted on javadoc.io.
Example
The following is a simple example of how this library can be used.
1. Import Dependency
xml
<dependency>
<groupId>io.github.chrimle</groupId>
<artifactId>spring-boot-static-property-injector</artifactId>
<version>0.1.1</version>
</dependency>
[!NOTE] This artifact is hosted on - Maven Central Repository - GitHub Packages
2. Include StaticValueInjector Bean
```java import io.github.chrimle.sbspi.StaticValueInjector; import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackageClasses = StaticValueInjector.class) class ExampleSpringBootApplication {} ```
3. Configure Bean Class Scanning using sbspi.basePackage
properties
sbspi.basePackage=your.example.app.subpackage
4. Annotate Fields with @StaticValue
```java import io.github.chrimle.sbspi.StaticValue;
public class Example {
// This field MAY remain null if the property is not set. @StaticValue("${myapp.custom.example-nullable-field}") private static String EXAMPLENULLABLEFIELD;
// This field MAY be set to "someDefaultValue" if the property is not set. @StaticValue("${myapp.custom.example-default-field:someDefaultValue}") private static String EXAMPLEDEFAULTFIELD;
} ```
5. If You encounter any issues
- For unexpected issues, a
StaticValueInjectorExceptionwill be thrown with a description of what went wrong. - In case of fields not being set as expected, review the
sbspi.basePackage-property and the package name of the relevant class. - Enable
DEBUGlogs forio.github.chrimle.sbspito see which fields have been processed. - Open a GitHub issue describing the issue and include the findings from these steps.
Road Map
Plan for the 1.0.0 release.
MAJOR
- TBD...
MINOR
- Support annotating
staticmethod arguments with@StaticValue - Support property prefixes on class-level
- Useful when annotating multiple fields with long common property prefixes.
- Improve
DEBUGlogs by masking potential secrets- Add
isSecret-property to the@StaticValueannotation to mask property values in logs.
- Add
PATCH
- Extend Test Suite
- Test more rigorously
- String
- Integer
- Boolean
Change Log
0.1.1
- Updated JavaDocs
StaticValueInjectorException
0.1.0
- Introduced
@StaticValue - Introduced
StaticValueInjector - Added Support for SpEL
- Added Support for Property Placeholders
- Published to GitHub Packages
- Published to Maven Central Repository
- Deployed GitHub Pages
- Deployed JavaDoc
Owner
- Name: Christopher Molin
- Login: Chrimle
- Kind: user
- Location: Gothenburg
- Company: Chrimle.com
- Website: https://chrimle.com
- Twitter: Chrimle
- Repositories: 1
- Profile: https://github.com/Chrimle
Software Engineer
GitHub Events
Total
- Release event: 3
- Watch event: 1
- Delete event: 17
- Public event: 1
- Push event: 26
- Pull request review event: 4
- Pull request event: 39
- Create event: 24
Last Year
- Release event: 3
- Watch event: 1
- Delete event: 17
- Public event: 1
- Push event: 26
- Pull request review event: 4
- Pull request event: 39
- Create event: 24
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Christopher Molin | 2****e | 13 |
| dependabot[bot] | 4****] | 1 |
Issues and Pull Requests
Last synced: 7 months ago
All Time
- Total issues: 0
- Total pull requests: 17
- Average time to close issues: N/A
- Average time to close pull requests: about 1 hour
- Total issue authors: 0
- Total pull request authors: 2
- Average comments per issue: 0
- Average comments per pull request: 0.06
- Merged pull requests: 13
- Bot issues: 0
- Bot pull requests: 4
Past Year
- Issues: 0
- Pull requests: 17
- Average time to close issues: N/A
- Average time to close pull requests: about 1 hour
- Issue authors: 0
- Pull request authors: 2
- Average comments per issue: 0
- Average comments per pull request: 0.06
- Merged pull requests: 13
- Bot issues: 0
- Bot pull requests: 4
Top Authors
Issue Authors
- Chrimle (1)
Pull Request Authors
- Chrimle (29)
- dependabot[bot] (11)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
- Total downloads: unknown
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 2
repo1.maven.org: io.github.chrimle:spring-boot-static-property-injector
Inject Spring-Boot properties to static contexts.
- Homepage: https://chrimle.github.io/spring-boot-static-property-injector
- Documentation: https://appdoc.app/artifact/io.github.chrimle/spring-boot-static-property-injector/
- License: Apache License 2.0
-
Latest release: 0.1.1
published 7 months ago
Rankings
Dependencies
- actions/checkout v4 composite
- actions/setup-java v4 composite
- actions/checkout v4 composite
- actions/setup-java v4 composite
- actions/github-script v6 composite
- org.springframework.boot:spring-boot-starter 3.5.0
- org.springframework.boot:spring-boot-starter-test 3.5.0 test