Skip to content

Commit

Permalink
Merge branch '5.10.x' into renovate/major-micronaut.cache
Browse files Browse the repository at this point in the history
  • Loading branch information
sdelamo authored Nov 26, 2024
2 parents 6e5ad7d + 135fb18 commit 4231357
Show file tree
Hide file tree
Showing 45 changed files with 1,112 additions and 122 deletions.
22 changes: 15 additions & 7 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
{
"extends": [
"config:base"
"config:recommended"
],
"addLabels": [
"type: dependency-upgrade"
],
"addLabels": ["type: dependency-upgrade"],
"schedule": [
"after 10pm every day"
"after 10pm"
],
"prHourlyLimit": 1,
"prConcurrentLimit": 20,
"timezone": "Europe/Prague",
"packageRules": [
{
"matchPackagePatterns": ["actions.*"],
"dependencyDashboardApproval": true,
"matchUpdateTypes": ["patch"],
"matchUpdateTypes": [
"patch"
],
"matchCurrentVersion": "!/^0/",
"automerge": true
"automerge": true,
"matchPackageNames": [
"/actions.*/"
]
},
{
"matchUpdateTypes": ["patch"],
"matchUpdateTypes": [
"patch"
],
"matchCurrentVersion": "!/^0/",
"automerge": true
}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
fetch-depth: 0

- name: "🔧 Setup GraalVM CE"
uses: graalvm/[email protected].3
uses: graalvm/[email protected].6
with:
distribution: 'graalvm'
java-version: ${{ matrix.java }}
Expand All @@ -70,15 +70,15 @@ jobs:
- name: "📊 Publish Test Report"
if: always()
uses: mikepenz/action-junit-report@v4
uses: mikepenz/action-junit-report@v5
with:
check_name: Java CI / Test Report (${{ matrix.java }})
report_paths: '**/build/test-results/test/TEST-*.xml'
check_retries: 'true'

- name: "📜 Upload binary compatibility check results"
if: matrix.java == '17'
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: binary-compatibility-reports
path: "**/build/reports/binary-compatibility-*.html"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ jobs:
# Store the hash in a file, which is uploaded as a workflow artifact.
sha256sum $ARTIFACTS | base64 -w0 > artifacts-sha256
- name: Upload build artifacts
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: gradle-build-outputs
path: build/repo/${{ steps.publish.outputs.group }}/*/${{ steps.publish.outputs.version }}/*
retention-days: 5
- name: Upload artifacts-sha256
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: artifacts-sha256
path: artifacts-sha256
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
Expand All @@ -160,6 +160,6 @@ jobs:
- name: Upload assets
# Upload the artifacts to the existing release. Note that the SLSA provenance will
# attest to each artifact file and not the aggregated ZIP file.
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
with:
files: artifacts.zip
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
projectVersion=5.7.1-SNAPSHOT
projectVersion=5.9.1-SNAPSHOT
projectGroup=io.micronaut.spring

title=Micronaut for Spring
Expand Down
14 changes: 7 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[versions]
managed-spring-boot = "3.3.2"
managed-spring = "6.1.10"
managed-spring-boot = "3.4.0"
managed-spring = "6.2.0"

groovy = "4.0.18"
h2 = '2.3.232'

micronaut = "4.5.3"
micronaut = "4.7.6"
micronaut-docs = "2.0.0"
micronaut-test = "4.2.0"
micronaut-test = "4.4.0"
micronaut-cache = "5.0.0"
micronaut-views = "5.4.4"
micronaut-validation = "4.6.1"
micronaut-servlet = "4.8.0"
micronaut-views = "5.6.0"
micronaut-validation = "4.8.0"
micronaut-servlet = "4.12.0"

[libraries]
# Micronaut
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pluginManagement {
}

plugins {
id 'io.micronaut.build.shared.settings' version '7.2.0'
id 'io.micronaut.build.shared.settings' version '7.3.0'
}

rootProject.name = 'spring-parent'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2017-2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.spring.annotation.context;

import io.micronaut.context.annotation.Secondary;
import io.micronaut.core.annotation.AnnotationValue;
import io.micronaut.inject.annotation.TypedAnnotationMapper;
import io.micronaut.inject.visitor.VisitorContext;
import java.util.List;
import org.springframework.context.annotation.Fallback;

public class FallbackAnnotationMapper
implements TypedAnnotationMapper<Fallback> {
@Override
public Class<Fallback> annotationType() {
return Fallback.class;
}

@Override
public List<AnnotationValue<?>> map(AnnotationValue<Fallback> annotation, VisitorContext visitorContext) {
return List.of(AnnotationValue.builder(Secondary.class).build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ io.micronaut.spring.annotation.context.ProfileAnnotationMapper
io.micronaut.spring.annotation.context.QualifierAnnotationMapper
io.micronaut.spring.annotation.context.BeanAnnotationMapper
io.micronaut.spring.annotation.context.ComponentAnnotationMapper
io.micronaut.spring.annotation.context.FallbackAnnotationMapper
io.micronaut.spring.annotation.context.RepositoryAnnotationMapper
io.micronaut.spring.annotation.context.ServiceAnnotationMapper
io.micronaut.spring.annotation.context.ConfigurationAnnotationMapper
Expand All @@ -16,4 +17,4 @@ io.micronaut.spring.annotation.cache.CacheableAnnotationMapper
io.micronaut.spring.annotation.cache.CachePutAnnotationMapper
io.micronaut.spring.annotation.cache.CacheEvictAnnotationMapper
io.micronaut.spring.annotation.tx.TransactionalAnnotationMapper
io.micronaut.spring.annotation.beans.ImportAnnotationMapper
io.micronaut.spring.annotation.beans.ImportAnnotationMapper
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@ public void close() {
stop();
}

@Override
public boolean isClosed() {
return !this.micronautContext.isRunning();
}

@Override
public boolean isActive() {
return isRunning();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ public void setValueSeparator(String valueSeparator) {
throw new UnsupportedOperationException("Method setValueSeparator not supported");
}

@Override
public void setEscapeCharacter(Character escapeCharacter) {
throw new UnsupportedOperationException("Method setEscapeCharacter not supported");
}

@Override
public void setIgnoreUnresolvableNestedPlaceholders(boolean ignoreUnresolvableNestedPlaceholders) {
throw new UnsupportedOperationException("Method setIgnoreUnresolvableNestedPlaceholders not supported");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.micronaut.spring.annotation.context

import io.micronaut.context.ApplicationContext
import spock.lang.Specification

class FallbackSpec extends Specification {

void "test fallback works"() {
when:
def context = ApplicationContext.run()

then:
context.getBean(MyInterface) instanceof MyFallback
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.micronaut.spring.annotation.context;

import org.springframework.context.annotation.Fallback;

@Fallback
public class MyFallback implements MyInterface {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package io.micronaut.spring.annotation.context;

public interface MyInterface {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.micronaut.spring.annotation.context;

import io.micronaut.context.annotation.Requires;
import org.springframework.stereotype.Component;

@Component
@Requires(property = "activation.property")
public class MyInterfaceImpl implements MyInterface {
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2020 original authors
* Copyright 2017-2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,22 +15,46 @@
*/
package io.micronaut.spring.web.annotation;

import io.micronaut.core.annotation.AnnotationValue;
import io.micronaut.core.annotation.Nullable;
import io.micronaut.http.annotation.CookieValue;
import io.micronaut.inject.visitor.VisitorContext;
import io.micronaut.spring.annotation.AbstractSpringAnnotationMapper;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;

/**
* Maps Spring CookieValue to Micronaut.
*
* @author graemerocher
* @since 1.0
*/
public class CookieValueAnnotationMapper extends WebBindAnnotationMapper<CookieValue> {
public class CookieValueAnnotationMapper extends AbstractSpringAnnotationMapper {
@Override
public String getName() {
return "org.springframework.web.bind.annotation.CookieValue";
}

@Override
Class<CookieValue> annotationType() {
return CookieValue.class;
protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) {
var annotations = new ArrayList<AnnotationValue<?>>();

var builder = AnnotationValue.builder(CookieValue.class);
var name = annotation.stringValue().orElse(annotation.stringValue("name").orElse(null));
if (name != null) {
builder.member("value", name);
}

annotation.stringValue("defaultValue").ifPresent(defaultValue -> builder.member("defaultValue", defaultValue));
annotations.add(builder.build());

var isRequired = annotation.booleanValue("required").orElse(true);
if (!isRequired) {
annotations.add(AnnotationValue.builder(Nullable.class).build());
}

return annotations;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2017-2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.spring.web.annotation;

import io.micronaut.core.annotation.AnnotationValue;
import io.micronaut.core.annotation.Nullable;
import io.micronaut.http.annotation.PathVariable;
import io.micronaut.inject.visitor.VisitorContext;
import io.micronaut.spring.annotation.AbstractSpringAnnotationMapper;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.List;

/**
* Maps Spring RequestMapping to Micronaut.
*
* @author graemerocher
* @since 1.0
*/
public class PathVariableAnnotationMapper extends AbstractSpringAnnotationMapper {
@Override
public String getName() {
return "org.springframework.web.bind.annotation.PathVariable";
}

@Override
protected List<AnnotationValue<?>> mapInternal(AnnotationValue<Annotation> annotation, VisitorContext visitorContext) {
var annotations = new ArrayList<AnnotationValue<?>>();

annotations.add(AnnotationValue.builder(PathVariable.class).member("value", annotation.stringValue().orElse("")).build());

var isRequired = annotation.booleanValue("required").orElse(true);
if (!isRequired) {
annotations.add(AnnotationValue.builder(Nullable.class).build());
}

return annotations;
}
}
Loading

0 comments on commit 4231357

Please sign in to comment.