-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
540 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
fj-doc-maven-plugin/src/main/resources/config/flavour/micronaut-4-copy.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
aot-jar.properties | ||
aot-native-image.properties | ||
openapi.properties | ||
micronaut-cli.yml | ||
src/main/resources/logback.xml |
37 changes: 37 additions & 0 deletions
37
fj-doc-maven-plugin/src/main/resources/config/flavour/micronaut-4/aot-jar.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# AOT configuration properties for jar packaging | ||
# Please review carefully the optimizations enabled below | ||
# Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details | ||
|
||
# Caches environment property values: environment properties will be deemed immutable after application startup. | ||
cached.environment.enabled=true | ||
|
||
# Precomputes Micronaut configuration property keys from the current environment variables | ||
precompute.environment.properties.enabled=true | ||
|
||
# Replaces logback.xml with a pure Java configuration | ||
logback.xml.to.java.enabled=true | ||
|
||
# Converts YAML configuration files to Java configuration | ||
yaml.to.java.config.enabled=true | ||
|
||
# Scans for service types ahead-of-time, avoiding classpath scanning at startup | ||
serviceloading.jit.enabled=true | ||
|
||
# Scans reactive types at build time instead of runtime | ||
scan.reactive.types.enabled=true | ||
|
||
# Deduces the environment at build time instead of runtime | ||
deduce.environment.enabled=true | ||
|
||
# Checks of existence of some types at build time instead of runtime | ||
known.missing.types.enabled=true | ||
|
||
# Precomputes property sources at build time | ||
sealed.property.source.enabled=true | ||
|
||
# The list of service types to be scanned (comma separated) | ||
service.types=io.micronaut.context.env.PropertySourceLoader,io.micronaut.inject.BeanConfiguration,io.micronaut.inject.BeanDefinitionReference,io.micronaut.http.HttpRequestFactory,io.micronaut.http.HttpResponseFactory,io.micronaut.core.beans.BeanIntrospectionReference,io.micronaut.core.convert.TypeConverterRegistrar,io.micronaut.context.env.PropertyExpressionResolver | ||
|
||
# A list of types that the AOT analyzer needs to check for existence (comma separated) | ||
known.missing.types.list=io.reactivex.Observable,reactor.core.publisher.Flux,kotlinx.coroutines.flow.Flow,io.reactivex.rxjava3.core.Flowable,io.reactivex.rxjava3.core.Observable,io.reactivex.Single,reactor.core.publisher.Mono,io.reactivex.Maybe,io.reactivex.rxjava3.core.Single,io.reactivex.rxjava3.core.Maybe,io.reactivex.Completable,io.reactivex.rxjava3.core.Completable,io.methvin.watchservice.MacOSXListeningWatchService,io.micronaut.core.async.publisher.CompletableFuturePublisher,io.micronaut.core.async.publisher.Publishers.JustPublisher,io.micronaut.core.async.subscriber.Completable | ||
|
40 changes: 40 additions & 0 deletions
40
...oc-maven-plugin/src/main/resources/config/flavour/micronaut-4/aot-native-image.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# AOT configuration properties for native-image packaging | ||
# Please review carefully the optimizations enabled below | ||
# Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details | ||
|
||
# Caches environment property values: environment properties will be deemed immutable after application startup. | ||
cached.environment.enabled=true | ||
|
||
# Precomputes Micronaut configuration property keys from the current environment variables | ||
precompute.environment.properties.enabled=true | ||
|
||
# Replaces logback.xml with a pure Java configuration | ||
logback.xml.to.java.enabled=true | ||
|
||
# Converts YAML configuration files to Java configuration | ||
yaml.to.java.config.enabled=false | ||
|
||
# Generates GraalVM configuration files required to load the AOT optimizations | ||
graalvm.config.enabled=true | ||
|
||
# Scans for service types ahead-of-time, avoiding classpath scanning at startup | ||
serviceloading.native.enabled=false | ||
|
||
# Scans reactive types at build time instead of runtime | ||
scan.reactive.types.enabled=true | ||
|
||
# Deduces the environment at build time instead of runtime | ||
deduce.environment.enabled=true | ||
|
||
# Checks of existence of some types at build time instead of runtime | ||
known.missing.types.enabled=true | ||
|
||
# Precomputes property sources at build time | ||
sealed.property.source.enabled=true | ||
|
||
# The list of service types to be scanned (comma separated) | ||
service.types=io.micronaut.context.env.PropertySourceLoader,io.micronaut.inject.BeanConfiguration,io.micronaut.inject.BeanDefinitionReference,io.micronaut.http.HttpRequestFactory,io.micronaut.http.HttpResponseFactory,io.micronaut.core.beans.BeanIntrospectionReference,io.micronaut.core.convert.TypeConverterRegistrar,io.micronaut.context.env.PropertyExpressionResolver | ||
|
||
# A list of types that the AOT analyzer needs to check for existence (comma separated) | ||
known.missing.types.list=io.reactivex.Observable,reactor.core.publisher.Flux,kotlinx.coroutines.flow.Flow,io.reactivex.rxjava3.core.Flowable,io.reactivex.rxjava3.core.Observable,io.reactivex.Single,reactor.core.publisher.Mono,io.reactivex.Maybe,io.reactivex.rxjava3.core.Single,io.reactivex.rxjava3.core.Maybe,io.reactivex.Completable,io.reactivex.rxjava3.core.Completable,io.methvin.watchservice.MacOSXListeningWatchService,io.micronaut.core.async.publisher.CompletableFuturePublisher,io.micronaut.core.async.publisher.Publishers.JustPublisher,io.micronaut.core.async.subscriber.Completable | ||
|
6 changes: 6 additions & 0 deletions
6
fj-doc-maven-plugin/src/main/resources/config/flavour/micronaut-4/micronaut-cli.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
applicationType: default | ||
defaultPackage: org.fugerit.java.demo | ||
testFramework: junit | ||
sourceLanguage: java | ||
buildTool: maven | ||
features: [app-name, graalvm, http-client-test, java, java-application, junit, logback, maven, maven-enforcer-plugin, micronaut-aot, micronaut-http-validation, netty-server, openapi, openapi-explorer, readme, serialization-jackson, shade, static-resources, yaml, yaml-build] |
7 changes: 7 additions & 0 deletions
7
fj-doc-maven-plugin/src/main/resources/config/flavour/micronaut-4/openapi.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
swagger-ui.enabled=false | ||
redoc.enabled=false | ||
openapi-explorer.enabled=true | ||
rapidoc.enabled=false | ||
rapidoc.bg-color=#14191f | ||
rapidoc.text-color=#aec2e0 | ||
rapidoc.sort-endpoints-by=method |
14 changes: 14 additions & 0 deletions
14
...maven-plugin/src/main/resources/config/flavour/micronaut-4/src/main/resources/logback.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<configuration> | ||
|
||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<!-- encoders are assigned the type | ||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> | ||
<encoder> | ||
<pattern>%cyan(%d{HH:mm:ss.SSS}) %gray([%thread]) %highlight(%-5level) %magenta(%logger{36}) - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="info"> | ||
<appender-ref ref="STDOUT" /> | ||
</root> | ||
</configuration> |
20 changes: 20 additions & 0 deletions
20
fj-doc-maven-plugin/src/main/resources/config/template/flavour/micronaut-4-fm-yml.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<#import 'flavour-macro.ftl' as fhm> | ||
--- | ||
flavour: micronaut-4 | ||
process: | ||
- from: flavour/micronaut-4/pom.ftl | ||
to: ${context.projectFolder}/pom.xml | ||
- from: flavour/micronaut-4/README.ftl | ||
to: ${context.projectFolder}/README.md | ||
- from: flavour/micronaut-4/gitignore.ftl | ||
to: ${context.projectFolder}/.gitignore | ||
- from: flavour/micronaut-4/MicronautController.ftl | ||
to: ${context.projectFolder}/src/main/java/<@fhm.toProjectPackageFolder context=context/>/${context.artifactIdAsClassName}Controller.java | ||
- from: flavour/micronaut-4/DocController.ftl | ||
to: ${context.projectFolder}/src/main/java/<@fhm.toProjectPackageFolder context=context/>/DocController.java | ||
- from: flavour/micronaut-4/Application.ftl | ||
to: ${context.projectFolder}/src/main/java/<@fhm.toProjectPackageFolder context=context/>/Application.java | ||
- from: flavour/micronaut-4/MicronautTest.ftl | ||
to: ${context.projectFolder}/src/test/java/test/<@fhm.toProjectPackageFolder context=context/>/${context.artifactIdAsClassName}Test.java | ||
- from: flavour/micronaut-4/application_yml.ftl | ||
to: ${context.projectFolder}/src/main/resources/application.yaml |
20 changes: 20 additions & 0 deletions
20
fj-doc-maven-plugin/src/main/resources/config/template/flavour/micronaut-4/Application.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<#import '../flavour-macro.ftl' as fhm> | ||
package <@fhm.toProjectPackage context=context/>; | ||
|
||
|
||
import io.micronaut.runtime.Micronaut; | ||
import io.swagger.v3.oas.annotations.*; | ||
import io.swagger.v3.oas.annotations.info.*; | ||
|
||
@OpenAPIDefinition( | ||
info = @Info( | ||
title = "${context.artifactId}", | ||
version = "${context.projectVersion}" | ||
) | ||
) | ||
public class Application { | ||
|
||
public static void main(String[] args) { | ||
Micronaut.run(Application.class, args); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
fj-doc-maven-plugin/src/main/resources/config/template/flavour/micronaut-4/DocController.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<#import | ||
'../flavour-macro.ftl' as fhm> | ||
package <@fhm.toProjectPackage context=context/>; | ||
|
||
import io.micronaut.http.annotation.*; | ||
|
||
import org.fugerit.java.core.cfg.ConfigRuntimeException; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.fugerit.java.doc.base.config.DocConfig; | ||
import org.fugerit.java.doc.base.process.DocProcessContext; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
@Slf4j | ||
@Controller("/doc") | ||
public class DocController { | ||
|
||
byte[] processDocument(String handlerId) { | ||
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { | ||
// creates the doc helper | ||
DocHelper docHelper = new DocHelper(); | ||
// create custom data for the fremarker template 'document.ftl' | ||
List<People> listPeople = Arrays.asList(new People("Luthien", "Tinuviel", "Queen"), new People("Thorin", "Oakshield", "King")); | ||
// output generation | ||
docHelper.getDocProcessConfig().fullProcess("document", DocProcessContext.newContext("listPeople", listPeople), handlerId, baos); | ||
// return the output | ||
return baos.toByteArray(); | ||
} catch (Exception e) { | ||
log.error(String.format("Error processing %s, error:%s", handlerId, e), e); | ||
throw new ConfigRuntimeException(e); | ||
} | ||
} | ||
|
||
@Get(uri="/example.md", produces="text/markdown") | ||
public byte[] markdownExample() { | ||
return processDocument(DocConfig.TYPE_MD); | ||
} | ||
|
||
@Get(uri="/example.html", produces="text/html") | ||
public byte[] markdownHtml() { | ||
return processDocument(DocConfig.TYPE_HTML); | ||
} | ||
|
||
<#if context.modules?seq_contains("fj-doc-mod-fop")> | ||
@Get(uri="/example.pdf", produces="application/pdf") | ||
public byte[] pdfExample() { | ||
return processDocument(DocConfig.TYPE_PDF); | ||
} | ||
</#if> | ||
|
||
<#if context.modules?seq_contains("fj-doc-mod-poi")> | ||
@Get(uri="/example.xlsx", produces="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") | ||
public byte[] xlsxExample() { | ||
return processDocument(DocConfig.TYPE_XLSX); | ||
} | ||
</#if> | ||
|
||
<#if context.modules?seq_contains("fj-doc-mod-opencsv")> | ||
@Get(uri="/example.csv", produces="text/csv") | ||
public byte[] csvExample() { | ||
return processDocument(DocConfig.TYPE_CSV); | ||
} | ||
</#if> | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
...ven-plugin/src/main/resources/config/template/flavour/micronaut-4/MicronautController.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<#import '../flavour-macro.ftl' as fhm> | ||
package <@fhm.toProjectPackage context=context/>; | ||
|
||
import io.micronaut.http.annotation.*; | ||
|
||
@Controller("${context.artifactId}") | ||
public class ${context.artifactIdAsClassName}Controller { | ||
|
||
@Get(uri="/", produces="text/plain") | ||
public String index() { | ||
return "Example Response"; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
fj-doc-maven-plugin/src/main/resources/config/template/flavour/micronaut-4/MicronautTest.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<#import '../flavour-macro.ftl' as fhm> | ||
package test.<@fhm.toProjectPackage context=context/>; | ||
|
||
import io.micronaut.runtime.EmbeddedApplication; | ||
import io.micronaut.test.extensions.junit5.annotation.MicronautTest; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.Assertions; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
@MicronautTest | ||
class ${context.artifactIdAsClassName}Test { | ||
|
||
@Inject | ||
EmbeddedApplication<?> application; | ||
|
||
@Test | ||
void testItWorks() { | ||
Assertions.assertTrue(application.isRunning()); | ||
} | ||
|
||
} |
Oops, something went wrong.