-
Notifications
You must be signed in to change notification settings - Fork 101
Makes CreateAutoConfigurationAction multi-module aware #369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fabapp2
merged 25 commits into
spring-projects-experimental:main
from
sanagaraj-pivotal:365-create-auto-configuration
Sep 5, 2022
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
8434328
Updated test container dependency
ashakirin c6624e4
Revert "Updated test container dependency"
ashakirin 597e140
Merge branch 'spring-projects-experimental:main' into main
sanagaraj-pivotal 48e5f8e
Merge branch 'spring-projects-experimental:main' into main
sanagaraj-pivotal ba6da28
Merge branch 'spring-projects-experimental:main' into main
sanagaraj-pivotal 4720e24
Merge branch 'spring-projects-experimental:main' into main
sanagaraj-pivotal 49e851c
Multi Module example project
sanagaraj-pivotal 0c64843
Itegration test scaffolding
sanagaraj-pivotal 030bfd7
Itegration test scaffolding
sanagaraj-pivotal 427534e
wip
sanagaraj-pivotal 3e90e61
CreateAutoconfigurationAction is multimodule aware
sanagaraj-pivotal 1ab8ba8
Multi maven module builds after migration
sanagaraj-pivotal aa9000b
Failing test, ehcache does not work with multi maven module spring app
sanagaraj-pivotal d01be95
Making it finder
sanagaraj-pivotal 297d20c
New approach using context.getModules
sanagaraj-pivotal d775816
Passing test after merge
sanagaraj-pivotal dcdee32
using applicationmodule.contains call
sanagaraj-pivotal 6a93903
Clean up integration test
sanagaraj-pivotal 35437e8
Removing unnecessary
sanagaraj-pivotal 6245cb0
clean up
sanagaraj-pivotal a71124b
Passing test
sanagaraj-pivotal 7a07705
Simplifying
sanagaraj-pivotal 405612b
Completed
sanagaraj-pivotal 61918b7
Removing exception throwing
sanagaraj-pivotal cfad527
Merge branch 'main' into 365-create-auto-configuration
fabapp2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
43 changes: 43 additions & 0 deletions
43
.../src/test/java/org/springframework/sbm/BootUpgrade_27_30_MultiModule_IntegrationTest.java
This file contains hidden or 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 @@ | ||
| /* | ||
| * Copyright 2021 - 2022 the original author or 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 org.springframework.sbm; | ||
|
|
||
| import org.junit.jupiter.api.Tag; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| public class BootUpgrade_27_30_MultiModule_IntegrationTest extends IntegrationTestBaseClass { | ||
| @Override | ||
| protected String getTestSubDir() { | ||
| return "boot-migration-27-30-multi-module"; | ||
| } | ||
|
|
||
| @Test | ||
| @Tag("integration") | ||
| void migrateMultiModuleApplication() { | ||
| intializeTestProject(); | ||
|
|
||
| scanProject(); | ||
|
|
||
| applyRecipe("boot-2.7-3.0-dependency-version-update"); | ||
|
|
||
| buildProject(); | ||
| } | ||
|
|
||
| private void buildProject() { | ||
| executeMavenGoals(getTestDir(), "clean", "verify"); | ||
| } | ||
| } |
8 changes: 8 additions & 0 deletions
8
...g-shell/src/test/resources/testcode/boot-migration-27-30-multi-module/README.md
This file contains hidden or 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,8 @@ | ||
| **Features used in the current project** | ||
|
|
||
| * ehcache in pom is mentioned this helps validate our migration to spring 3 where ehcache classifier has to be used to resolve version. | ||
| * Uses Constructor binding on classes which will be removed when migrating to Spring 3 | ||
| * Uses PagingAndSortingRepo interface where CrudRepo has been removed. | ||
| * Uses properties that will be removed/moved on spring 3 migration | ||
| * Uses micrometer packages which are moved to a new structure. | ||
|
|
||
48 changes: 48 additions & 0 deletions
48
...ations/spring-shell/src/test/resources/testcode/boot-migration-27-30-multi-module/pom.xml
This file contains hidden or 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,48 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
| <packaging>pom</packaging> | ||
| <modules> | ||
| <module>spring-app</module> | ||
| </modules> | ||
|
|
||
| <parent> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-parent</artifactId> | ||
| <version>2.7.1</version> | ||
| </parent> | ||
| <groupId>com.example</groupId> | ||
| <artifactId>boot-upgrade-27_30</artifactId> | ||
| <version>0.0.1-SNAPSHOT</version> | ||
| <name>boot-upgrade-27_30</name> | ||
| <description>boot-upgrade-27_30</description> | ||
| <properties> | ||
| <java.version>17</java.version> | ||
| </properties> | ||
|
|
||
|
|
||
| <repositories> | ||
| <repository> | ||
| <id>spring-snapshot</id> | ||
| <url>https://repo.spring.io/snapshot</url> | ||
| <releases> | ||
| <enabled>false</enabled> | ||
| </releases> | ||
| </repository> | ||
| <repository> | ||
| <id>spring-milestone</id> | ||
| <url>https://repo.spring.io/milestone</url> | ||
| <snapshots> | ||
| <enabled>false</enabled> | ||
| </snapshots> | ||
| </repository> | ||
| <repository> | ||
| <id>spring-release</id> | ||
| <url>https://repo.spring.io/release</url> | ||
| <snapshots> | ||
| <enabled>false</enabled> | ||
| </snapshots> | ||
| </repository> | ||
| </repositories> | ||
| </project> |
75 changes: 75 additions & 0 deletions
75
...ng-shell/src/test/resources/testcode/boot-migration-27-30-multi-module/spring-app/pom.xml
This file contains hidden or 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,75 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| ~ Copyright 2021 - 2022 the original author or 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. | ||
| --> | ||
|
|
||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <parent> | ||
| <artifactId>boot-upgrade-27_30</artifactId> | ||
| <groupId>com.example</groupId> | ||
| <version>0.0.1-SNAPSHOT</version> | ||
| </parent> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <artifactId>spring-app</artifactId> | ||
|
|
||
| <properties> | ||
| <maven.compiler.source>17</maven.compiler.source> | ||
| <maven.compiler.target>17</maven.compiler.target> | ||
| </properties> | ||
| <dependencies> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-web</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.ehcache</groupId> | ||
| <artifactId>ehcache</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-data-jpa</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>com.h2database</groupId> | ||
| <artifactId>h2</artifactId> | ||
| <scope>runtime</scope> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>io.projectreactor</groupId> | ||
| <artifactId>reactor-core</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.johnzon</groupId> | ||
| <artifactId>johnzon-core</artifactId> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-starter-test</artifactId> | ||
| <scope>test</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.springframework.boot</groupId> | ||
| <artifactId>spring-boot-maven-plugin</artifactId> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |
13 changes: 13 additions & 0 deletions
13
.../boot-migration-27-30-multi-module/spring-app/src/main/java/com/hello/GreetingConfig.java
This file contains hidden or 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 com.hello; | ||
|
|
||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
|
|
||
| @Configuration | ||
| public class GreetingConfig { | ||
|
|
||
| @Bean | ||
| public String hello() { | ||
| return "こんにちは"; | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
...-30-multi-module/spring-app/src/main/java/org/springboot/example/ehcache/EventLogger.java
This file contains hidden or 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 org.springboot.example.ehcache; | ||
|
|
||
| import org.ehcache.event.CacheEvent; | ||
| import org.ehcache.event.CacheEventListener; | ||
|
|
||
| public class EventLogger implements CacheEventListener<Object, Object> { | ||
| @Override | ||
| public void onEvent(CacheEvent<?, ?> cacheEvent) { | ||
| System.out.println("My ehcache event listener is called"); | ||
| } | ||
| } |
12 changes: 12 additions & 0 deletions
12
...e/spring-app/src/main/java/org/springboot/example/upgrade/BootUpgrade2730Application.java
This file contains hidden or 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 org.springboot.example.upgrade; | ||
|
|
||
| import org.springframework.boot.SpringApplication; | ||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
|
||
| @SpringBootApplication | ||
| public class BootUpgrade2730Application { | ||
|
|
||
| public static void main(String[] args) { | ||
| SpringApplication.run(BootUpgrade2730Application.class, args); | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
...ule/spring-app/src/main/java/org/springboot/example/upgrade/ConstructorBindingConfig.java
This file contains hidden or 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 @@ | ||
| package org.springboot.example.upgrade; | ||
|
|
||
| import org.springframework.boot.context.properties.ConfigurationProperties; | ||
| import org.springframework.boot.context.properties.ConstructorBinding; | ||
|
|
||
| @ConfigurationProperties(prefix = "mail") | ||
| @ConstructorBinding | ||
| public class ConstructorBindingConfig { | ||
| private String hostName; | ||
|
|
||
| public ConstructorBindingConfig(String hostName) { | ||
| this.hostName = hostName; | ||
| } | ||
| } |
19 changes: 19 additions & 0 deletions
19
...-module/spring-app/src/main/java/org/springboot/example/upgrade/RepositoryController.java
This file contains hidden or 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,19 @@ | ||
| package org.springboot.example.upgrade; | ||
|
|
||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Component | ||
| public class RepositoryController { | ||
| private final StudentRepoPagingAndSorting studentRepoPagingAndSorting; | ||
|
|
||
| public RepositoryController( | ||
| StudentRepoPagingAndSorting studentRepoPagingAndSorting) { | ||
| this.studentRepoPagingAndSorting = studentRepoPagingAndSorting; | ||
| } | ||
|
|
||
| public void actWithRepositories() { | ||
| studentRepoPagingAndSorting.save(new Student()); | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
...n-27-30-multi-module/spring-app/src/main/java/org/springboot/example/upgrade/Student.java
This file contains hidden or 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 org.springboot.example.upgrade; | ||
|
|
||
| import javax.persistence.Entity; | ||
| import javax.persistence.Id; | ||
|
|
||
| @Entity | ||
| public class Student { | ||
| @Id | ||
| private long id; | ||
| private String name; | ||
| } |
6 changes: 6 additions & 0 deletions
6
.../spring-app/src/main/java/org/springboot/example/upgrade/StudentRepoPagingAndSorting.java
This file contains hidden or 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 @@ | ||
| package org.springboot.example.upgrade; | ||
|
|
||
| import org.springframework.data.repository.PagingAndSortingRepository; | ||
|
|
||
| public interface StudentRepoPagingAndSorting extends PagingAndSortingRepository<Student, Long> { | ||
| } |
1 change: 1 addition & 0 deletions
1
...boot-migration-27-30-multi-module/spring-app/src/main/resources/META-INF/spring.factories
This file contains hidden or 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 @@ | ||
| org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.hello.GreetingConfig |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍