Skip to content
Merged
Show file tree
Hide file tree
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 Aug 18, 2022
c6624e4
Revert "Updated test container dependency"
ashakirin Aug 18, 2022
597e140
Merge branch 'spring-projects-experimental:main' into main
sanagaraj-pivotal Aug 22, 2022
48e5f8e
Merge branch 'spring-projects-experimental:main' into main
sanagaraj-pivotal Aug 24, 2022
ba6da28
Merge branch 'spring-projects-experimental:main' into main
sanagaraj-pivotal Aug 25, 2022
4720e24
Merge branch 'spring-projects-experimental:main' into main
sanagaraj-pivotal Aug 26, 2022
49e851c
Multi Module example project
sanagaraj-pivotal Aug 22, 2022
0c64843
Itegration test scaffolding
sanagaraj-pivotal Aug 22, 2022
030bfd7
Itegration test scaffolding
sanagaraj-pivotal Aug 22, 2022
427534e
wip
sanagaraj-pivotal Aug 23, 2022
3e90e61
CreateAutoconfigurationAction is multimodule aware
sanagaraj-pivotal Aug 24, 2022
1ab8ba8
Multi maven module builds after migration
sanagaraj-pivotal Aug 24, 2022
aa9000b
Failing test, ehcache does not work with multi maven module spring app
sanagaraj-pivotal Aug 24, 2022
d01be95
Making it finder
sanagaraj-pivotal Aug 24, 2022
297d20c
New approach using context.getModules
sanagaraj-pivotal Aug 26, 2022
d775816
Passing test after merge
sanagaraj-pivotal Aug 26, 2022
dcdee32
using applicationmodule.contains call
sanagaraj-pivotal Aug 26, 2022
6a93903
Clean up integration test
sanagaraj-pivotal Aug 26, 2022
35437e8
Removing unnecessary
sanagaraj-pivotal Aug 26, 2022
6245cb0
clean up
sanagaraj-pivotal Aug 26, 2022
a71124b
Passing test
sanagaraj-pivotal Aug 26, 2022
7a07705
Simplifying
sanagaraj-pivotal Aug 26, 2022
405612b
Completed
sanagaraj-pivotal Aug 26, 2022
61918b7
Removing exception throwing
sanagaraj-pivotal Sep 5, 2022
cfad527
Merge branch 'main' into 365-create-auto-configuration
fabapp2 Sep 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void migrateSimpleApplication() {
verifyEhCacheVersionIsUpgraded();
verifyJohnzonCoreDependencyIsUpgraded();
}

private void buildProject() {
executeMavenGoals(getTestDir(), "clean", "verify");
}
Expand Down
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");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**Features used in the current project**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


* 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.

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>
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>
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 "こんにちは";
}
}
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");
}
}
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);
}
}
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;
}
}
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());
}
}
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;
}
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> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.hello.GreetingConfig
Loading