-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '6.2.x' into renovate/com.gradle.enterprise-3.x
- Loading branch information
Showing
17 changed files
with
343 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
buildscript { | ||
repositories { | ||
maven { url = 'https://repo.grails.org/grails/core' } | ||
} | ||
dependencies { | ||
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion" | ||
} | ||
} | ||
|
||
group = 'issue11767.app' | ||
|
||
apply plugin: 'application' | ||
apply plugin: 'groovy' | ||
apply plugin: 'org.grails.grails-web' | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { url = 'https://repo.grails.org/grails/core' } | ||
} | ||
|
||
dependencyManagement { | ||
imports { mavenBom "org.grails:grails-bom:$grailsVersion" } | ||
applyMavenExclusions false | ||
} | ||
|
||
dependencies { | ||
|
||
implementation project(':issue-11767-plugin') | ||
|
||
implementation 'org.grails:grails-core' | ||
implementation 'org.grails:grails-logging' | ||
implementation 'org.grails:grails-plugin-url-mappings' | ||
implementation 'org.springframework.boot:spring-boot-starter-tomcat' | ||
|
||
compileOnly 'io.micronaut:micronaut-inject-groovy' | ||
|
||
testImplementation 'io.micronaut:micronaut-http-client' | ||
testImplementation 'io.micronaut:micronaut-inject-groovy' | ||
testImplementation 'org.grails:grails-web-testing-support' | ||
testImplementation 'org.spockframework:spock-core' | ||
|
||
} | ||
|
||
application { | ||
mainClass = 'issue11767.Application' | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
} |
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,43 @@ | ||
my: | ||
value1: 'this is value 1 from application.yml' | ||
|
||
--- | ||
|
||
info: | ||
app: | ||
name: '@info.app.name@' | ||
version: '@info.app.version@' | ||
grailsVersion: '@info.app.grailsVersion@' | ||
grails: | ||
mime: | ||
disable: | ||
accept: | ||
header: | ||
userAgents: | ||
- Gecko | ||
- WebKit | ||
- Presto | ||
- Trident | ||
types: | ||
all: '*/*' | ||
atom: application/atom+xml | ||
css: text/css | ||
csv: text/csv | ||
form: application/x-www-form-urlencoded | ||
html: | ||
- text/html | ||
- application/xhtml+xml | ||
js: text/javascript | ||
json: | ||
- application/json | ||
- text/json | ||
multipartForm: multipart/form-data | ||
pdf: application/pdf | ||
rss: application/rss+xml | ||
text: text/plain | ||
hal: | ||
- application/hal+json | ||
- application/hal+xml | ||
xml: | ||
- text/xml | ||
- application/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,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
|
||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" /> | ||
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> | ||
|
||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<withJansi>true</withJansi> | ||
<encoder> | ||
<charset>UTF-8</charset> | ||
<pattern>%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="error"> | ||
<appender-ref ref="STDOUT" /> | ||
</root> | ||
|
||
<logger name="grails.boot.config.GrailsApplicationPostProcessor" level="DEBUG" additivity="false"><appender-ref ref="STDOUT"/></logger> | ||
|
||
</configuration> |
32 changes: 32 additions & 0 deletions
32
issue-11767/grails-app/controllers/issue11767/app/AppController.groovy
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,32 @@ | ||
package issue11767.app | ||
|
||
import issue11767.plugin.PluginGroovyMicronautBean | ||
import issue11767.plugin.PluginGroovySpringBean | ||
import issue11767.plugin.PluginJavaMicronautBean | ||
import org.springframework.beans.factory.annotation.Autowired | ||
|
||
class AppController { | ||
|
||
PluginGroovySpringBean pluginGroovySpringBean | ||
@Autowired PluginGroovyMicronautBean pluginGroovyMicronautConfigBean | ||
@Autowired PluginJavaMicronautBean pluginJavaMicronautConfigBean | ||
@Autowired AppGroovyMicronautBean appGroovyMicronautConfigBean | ||
|
||
def index() { | ||
render """ | ||
<pre> | ||
Plugin Groovy Spring Bean - my.value1: ${pluginGroovySpringBean.value1} | ||
Plugin Groovy Spring Bean - my.value2: ${pluginGroovySpringBean.value2} | ||
<br> | ||
Plugin Groovy Micronaut Bean - my.value1: ${pluginGroovyMicronautConfigBean.value1} | ||
Plugin Groovy Micronaut Bean - my.value2: ${pluginGroovyMicronautConfigBean.value2} | ||
<br> | ||
Plugin Java Micronaut Bean - my.value1: ${pluginJavaMicronautConfigBean.value1} | ||
Plugin Java Micronaut Bean - my.value2: ${pluginJavaMicronautConfigBean.value2} | ||
<br> | ||
App Groovy Micronaut Bean - my.value1: ${appGroovyMicronautConfigBean.value1} | ||
App Groovy Micronaut Bean - my.value2: ${appGroovyMicronautConfigBean.value2} | ||
</pre> | ||
""".stripIndent() | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
issue-11767/grails-app/controllers/issue11767/app/UrlMappings.groovy
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,11 @@ | ||
package issue11767.app | ||
|
||
class UrlMappings { | ||
static mappings = { | ||
"/$controller/$action?/$id?(.$format)?"{ | ||
constraints { | ||
// apply constraints here | ||
} | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
issue-11767/grails-app/init/issue11767/app/Application.groovy
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,12 @@ | ||
package issue11767.app | ||
|
||
import grails.boot.GrailsApp | ||
import grails.boot.config.GrailsAutoConfiguration | ||
import groovy.transform.CompileStatic | ||
|
||
@CompileStatic | ||
class Application extends GrailsAutoConfiguration { | ||
static void main(String[] args) { | ||
GrailsApp.run(Application, args) | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
issue-11767/src/integration-test/groovy/issue11767/app/ConfigLoadingSpec.groovy
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,42 @@ | ||
package issue11767.app | ||
|
||
import grails.testing.mixin.integration.Integration | ||
import grails.testing.spock.OnceBefore | ||
import io.micronaut.http.HttpRequest | ||
import io.micronaut.http.client.HttpClient | ||
import spock.lang.AutoCleanup | ||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
import spock.lang.Unroll | ||
|
||
@Integration | ||
class ConfigLoadingSpec extends Specification { | ||
|
||
@Shared | ||
@AutoCleanup | ||
HttpClient httpClient | ||
|
||
@OnceBefore | ||
void init() { | ||
def baseUrl = "http://localhost:$serverPort" | ||
httpClient = HttpClient.create(baseUrl.toURL()) | ||
} | ||
|
||
@Unroll | ||
void '#beanType beans can load plugin config values'(String beanType, String expectedResponseValue) { | ||
|
||
when: 'The app controller is visited' | ||
def request = HttpRequest.GET('/app') | ||
String response = httpClient.toBlocking().retrieve(request, String) | ||
|
||
then: 'The value from the plugin is found' | ||
response.contains(expectedResponseValue) | ||
|
||
where: | ||
beanType || expectedResponseValue | ||
'Plugin Groovy Spring' || 'Plugin Groovy Spring Bean - my.value2: this is value 2 from plugin.yml' | ||
'Plugin Groovy Micronaut' || 'Plugin Groovy Micronaut Bean - my.value2: this is value 2 from plugin.yml' | ||
'Plugin Java Micronaut' || 'Plugin Java Micronaut Bean - my.value2: this is value 2 from plugin.yml' | ||
'App Groovy Micronaut' || 'App Groovy Micronaut Bean - my.value2: this is value 2 from plugin.yml' | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
issue-11767/src/main/groovy/issue11767/app/AppGroovyMicronautBean.groovy
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,9 @@ | ||
package issue11767.app | ||
|
||
import io.micronaut.context.annotation.ConfigurationProperties | ||
|
||
@ConfigurationProperties('my') | ||
class AppGroovyMicronautBean { | ||
String value1 | ||
String value2 | ||
} |
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,35 @@ | ||
buildscript { | ||
repositories { | ||
maven { url = 'https://repo.grails.org/grails/core' } | ||
} | ||
dependencies { | ||
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion" | ||
} | ||
} | ||
|
||
apply plugin: 'groovy' | ||
apply plugin: 'org.grails.grails-plugin' | ||
|
||
group = 'issue11767.plugin' | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { url = 'https://repo.grails.org/grails/core' } | ||
} | ||
|
||
dependencyManagement { | ||
imports { | ||
mavenBom "org.grails:grails-bom:$grailsVersion" | ||
} | ||
applyMavenExclusions false | ||
} | ||
|
||
dependencies { | ||
annotationProcessor 'io.micronaut:micronaut-inject-java' | ||
implementation 'org.grails:grails-core' | ||
compileOnly 'io.micronaut:micronaut-inject-groovy' | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
} |
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,3 @@ | ||
my: | ||
value1: 'this is value 1 from plugin.yml' | ||
value2: 'this is value 2 from plugin.yml' |
16 changes: 16 additions & 0 deletions
16
plugins/issue-11767-plugin/grails-app/init/issue11767/plugin/Application.groovy
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,16 @@ | ||
package issue11767.plugin | ||
|
||
import grails.boot.GrailsApp | ||
import grails.boot.config.GrailsAutoConfiguration | ||
import groovy.transform.CompileStatic | ||
import grails.plugins.metadata.* | ||
import org.springframework.context.annotation.ComponentScan | ||
|
||
@CompileStatic | ||
@PluginSource | ||
@ComponentScan(basePackages = 'issue11767.plugin') | ||
class Application extends GrailsAutoConfiguration { | ||
static void main(String[] args) { | ||
GrailsApp.run(Application, args) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
plugins/issue-11767-plugin/src/main/groovy/issue11767/plugin/MyPluginGrailsPlugin.groovy
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,15 @@ | ||
package issue11767.plugin | ||
|
||
import grails.plugins.* | ||
|
||
class Issue11767GrailsPlugin extends Plugin { | ||
|
||
def title = 'Issue 11767' | ||
def author = 'Mattias Reichel' | ||
def authorEmail = '' | ||
def description = '' | ||
|
||
Closure doWithSpring() {{ -> | ||
pluginGroovySpringBean(PluginGroovySpringBean) | ||
}} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ins/issue-11767-plugin/src/main/groovy/issue11767/plugin/PluginGroovyMicronautBean.groovy
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,11 @@ | ||
package issue11767.plugin | ||
|
||
import groovy.transform.CompileStatic | ||
import io.micronaut.context.annotation.ConfigurationProperties | ||
|
||
@CompileStatic | ||
@ConfigurationProperties('my') | ||
class PluginGroovyMicronautBean { | ||
String value1 | ||
String value2 | ||
} |
13 changes: 13 additions & 0 deletions
13
plugins/issue-11767-plugin/src/main/groovy/issue11767/plugin/PluginGroovySpringBean.groovy
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 @@ | ||
package issue11767.plugin | ||
|
||
import groovy.transform.CompileStatic | ||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
import org.springframework.context.annotation.Configuration | ||
|
||
@CompileStatic | ||
@Configuration | ||
@ConfigurationProperties(prefix = 'my') | ||
class PluginGroovySpringBean { | ||
String value1 | ||
String value2 | ||
} |
26 changes: 26 additions & 0 deletions
26
plugins/issue-11767-plugin/src/main/java/issue11767/plugin/PluginJavaMicronautBean.java
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,26 @@ | ||
package issue11767.plugin; | ||
|
||
import io.micronaut.context.annotation.ConfigurationProperties; | ||
|
||
@ConfigurationProperties("my") | ||
public class PluginJavaMicronautBean { | ||
|
||
private String value1; | ||
private String value2; | ||
|
||
public String getValue1() { | ||
return value1; | ||
} | ||
|
||
public void setValue1(String value1) { | ||
this.value1 = value1; | ||
} | ||
|
||
public String getValue2() { | ||
return value2; | ||
} | ||
|
||
public void setValue2(String value2) { | ||
this.value2 = value2; | ||
} | ||
} |
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