https://github.com/eitco/spring-config-generator
This java annotation processor scans for spring annotations that mark a class as injectable and generates a spring configuration class containing imports for all classes marked this way
https://github.com/eitco/spring-config-generator
Last synced: about 1 year ago
JSON representation
This java annotation processor scans for spring annotations that mark a class as injectable and generates a spring configuration class containing imports for all classes marked this way
- Host: GitHub
- URL: https://github.com/eitco/spring-config-generator
- Owner: eitco
- License: mit
- Created: 2024-07-23T08:08:05.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-01T06:33:24.000Z (almost 2 years ago)
- Last Synced: 2024-08-01T08:11:03.317Z (almost 2 years ago)
- Language: Java
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://opensource.org/license/mit)
[](https://github.com/eitco/spring-config-generator/actions/workflows/deploy.yaml)
[](https://central.sonatype.com/artifact/de.eitco.cicd/spring-config-generator)
# spring-config-generator
This [java annotation processor](https://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/Processor.html) scans for spring annotations that mark a class as a stereotype and generates a spring configuration class containing imports for all classes marked this way.
It is integrated by adding the module as a dependency to a project:
```xml
de.eitco.cicd
spring-config-generator
4.0.2
true
```
The following annotations are recognized:
* `@Component`
* `@Service`
* `@Repository`
* `@Controller`
* `@RestController`
* `@ControllerAdvice`
* `@RestControllerAdvice`
* `@Configuration`
* `@Endpoint`
The annotation processor will generate a java file that defines a spring configuration that imports all classes processed
that are annotated with one of these annotations. The code of the generated class will roughly look like this:
```java
package ;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import javax.annotation.processing.Generated;
@Generated("de.eitco.commons.build.essentials.config.generator.SpringConfigGenerationProcessor")
@Configuration
@Import({
})
public class {}
```
The target package can be configured using the annotation processor parameter `generated.spring.config.package` which defaults to `de.eitco`.
The class name can be configured using the annotation processor parameter `generated.spring.config.class` defaulting to `ComponentConfiguration`.
The [integration tests](./src/it) pose a simple example.