Skip to content
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

Upgrade to Spring Boot 3.0.0 #1287

Merged
merged 185 commits into from
Jan 19, 2023
Merged

Upgrade to Spring Boot 3.0.0 #1287

merged 185 commits into from
Jan 19, 2023

Conversation

JoeWang1127
Copy link
Contributor

@JoeWang1127 JoeWang1127 commented Oct 11, 2022

BEGIN_COMMIT_OVERRIDE

feat!: This release officially introduces Spring Boot 3.x compatibility. Note that breaking changes occur in this release. For full list of changes, refer to this.

END_COMMIT_OVERRIDE

Migration guide

Migration Guide from Spring Cloud GCP 3.x to 4.x

Changes applied to all modules

  1. Minimum system requirements needed for upgrade
    • Java 17
  2. Spring Framework libraries upgrade
  3. Upgrade plugin versions
  4. Remove Java 8 and Java 11 in CI
  5. Remove GraalVM and native compile in CI
  6. Enable auto-configuration
  7. fix Disconnect from spring-cloud-dependencies-parent #1294

Changes in each module

  1. Bigquery
    • Remove deprecated methods
    • Replace ListenableFuture and SettableListenableFuture with CompletableFuture, reference
    • Code polish
    • Improve code coverage
  2. Cloud SQL
  3. Datastore
    • Remove deprecated methods and constructors
    • Replace ClassTypeInformation with TypeInformation, reference
    • Extend inheritance of DatastoreRepository, reference
    • Change datastore-basic-sample to a web application to remove spring-shell dependency
    • Fix broken tests
    • Code polish
  4. Firestore
    • Replace ClassTypeInformation with TypeInformation, reference
    • Code polish
  5. Kotlin sample
    • Code polish
  6. Logging
    • Replace javax.servlet with jakarta.servlet, reference
    • Remove deprecated methods
    • Code polish
  7. Native support
  8. Pubsub
    • Replace ListenableFuture and SettableListenableFuture with CompletableFuture, reference
    • Remove deprecated methods and constructors
    • Code polish
  9. Pubsub-stream-binder
    • Change to functional programming model, reference
    • Change spring-cloud-stream-binder-test to spring-cloud-stream-test-support, reference
    • Fix broken tests
  10. Secret Manager
    • Delete GcpSecretManagerBootstrapConfiguration
  11. Security
    • Replace javax.servlet with jakarta.servlet, reference
  12. Spanner
    • Replace PreferredConstructor with InstanceCreatorMetadata
    • Replace ClassTypeInformation with TypeInformation, reference
    • Remove deprecated methods and constructors
    • Extend inheritance of SpannerRepository, reference
    • Fix broken tests
    • Code polish
  13. Storage
    • Remove deprecated methods
    • Code polish
    • Improve code coverage
  14. Trace, reference
    • Remove spring-cloud-sleuth dependency
    • Instrument trace using Observation API
    • Remove deprecated methods
    • Fix broken tests
  15. Vision
    • Replace ListenableFuture and SettableListenableFuture with CompletableFuture, reference
    • Fix broken tests
    • Code polish

@JoeWang1127 JoeWang1127 linked an issue Oct 13, 2022 that may be closed by this pull request
@JoeWang1127 JoeWang1127 force-pushed the feature/boot3.0-migrator branch from 8cf7cb7 to b57dd4c Compare October 21, 2022 17:35
@JoeWang1127 JoeWang1127 force-pushed the feature/boot3.0-migrator branch 2 times, most recently from 7429583 to ea807c7 Compare November 3, 2022 19:24
@JoeWang1127 JoeWang1127 force-pushed the feature/boot3.0-migrator branch 2 times, most recently from 08ebdf6 to 69545ab Compare November 16, 2022 15:35
@JoeWang1127 JoeWang1127 force-pushed the feature/boot3.0-migrator branch 6 times, most recently from 0cb8ffe to 80cbbd8 Compare December 3, 2022 02:27
@JoeWang1127
Copy link
Contributor Author

JoeWang1127 commented Dec 5, 2022

Hi @elefeint, could you sign the CLA? The previous one seems expired.

@suztomo
Copy link
Contributor

suztomo commented Dec 5, 2022

CLA

@JoeWang1127 JoeWang1127 force-pushed the feature/boot3.0-migrator branch 2 times, most recently from d5fbb9c to 4a2a4d7 Compare December 5, 2022 21:16
@JoeWang1127
Copy link
Contributor Author

I modify the commits to reset the author, hope you don't mind, Elena.

@JoeWang1127 JoeWang1127 marked this pull request as ready for review December 5, 2022 21:29
@JoeWang1127 JoeWang1127 marked this pull request as draft December 9, 2022 01:22
@JoeWang1127 JoeWang1127 marked this pull request as ready for review December 9, 2022 02:01
@JoeWang1127 JoeWang1127 linked an issue Dec 9, 2022 that may be closed by this pull request
Copy link
Member

@meltsufin meltsufin left a comment

Choose a reason for hiding this comment

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

First pass...

This an impressive amount of work! It would probably have been easier for reviewing to split into separate PRs, but I think we can manage this time.

In addition to the comments inline, here are a few more observations:

  1. There are still many references in comments, documentation, and text for ListenableFuture which should be replaced with CompletableFuture.
  2. spring-cloud-gcp-starter-sql-mysql-r2dbc directory has not been deleted
  3. sql.adoc is not updated to remove mysql-r2dbc
  4. Generally, please make sure that sample code in the documentation is still correct
  5. There are still numerous mentions of Sleuth in the project, mostly in documentation.

pom.xml Outdated Show resolved Hide resolved
@EnableConfigurationProperties({GcpTraceProperties.class})
@ConditionalOnProperty(
value = {"spring.sleuth.enabled", "spring.cloud.gcp.trace.enabled"},
Copy link
Member

Choose a reason for hiding this comment

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

What's the replacement for these properties in Spring Boot?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sleuth is removed from Spring Cloud release train, so sleuth-related properties are no longer exist.

Copy link

@nhmarujo nhmarujo Dec 18, 2022

Choose a reason for hiding this comment

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

Copy link
Contributor

@suztomo suztomo Dec 18, 2022

Choose a reason for hiding this comment

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

@JoeWang1127 Mike is asking a replacement of this property exists or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

spring.sleuth.enabled doesn't exist anymore.

To use trace, set spring.cloud.gcp.trace.enabled to true.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good. Ensure the migration document has the explanation.

spring-cloud-gcp-dependencies/pom.xml Outdated Show resolved Hide resolved
@@ -16,8 +16,6 @@ spring.cloud.stream.gcp.pubsub.bindings.logUserMessage-in-0.consumer.ackMode=MAN
# The application also subscribes to the dead letter topic to show that it's just another normal topic.
spring.cloud.stream.bindings.deadLetterMessages-in-0.destination=my-dead-letter-topic

spring.cloud.stream.gcp.pubsub.default.consumer.auto-create-resources=true
Copy link
Member

Choose a reason for hiding this comment

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

This is still in the docs though. Please update documentation as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The docs are updated.

I'm not sure whether we still need the polling example and I'll do more research about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The legacy imperative programming model has been removed, so we don't need the polling example now.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

81.6% 81.6% Coverage
0.0% 0.0% Duplication

@JoeWang1127 JoeWang1127 merged commit 0caa9b6 into main Jan 19, 2023
@JoeWang1127 JoeWang1127 deleted the feature/boot3.0-migrator branch January 19, 2023 19:47
@HabeebCycle
Copy link

Congrats guys on this nice job.

@ddixit14 ddixit14 changed the title Upgrade to Spring Boot 3.0.0 feat!: Upgrade to Spring Boot 3.0.0 Jan 20, 2023
@ddixit14 ddixit14 changed the title feat!: Upgrade to Spring Boot 3.0.0 Upgrade to Spring Boot 3.0.0 Jan 20, 2023
@ls-urs-keller
Copy link

Thank you for the work. Impatiently waiting for this to be published in maven central.

@Harmelodic
Copy link

It's released! 🚀

https://repo1.maven.org/maven2/com/google/cloud/spring-cloud-gcp-dependencies/4.0.0/

@HabeebCycle
Copy link

This is awesome. Thank you guys for this awesome work.

@codependent
Copy link

Congrats on the great work!

Is there any upgrade guide available?

I've run into this error after bumping up to 4.0.0:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spanReporter' defined in class path resource [org/springframework/boot/actuate/autoconfigure/tracing/zipkin/ZipkinConfigurations$ReporterConfiguration.class]: Failed to instantiate [zipkin2.reporter.AsyncReporter]: Factory method 'spanReporter' threw exception with message: Encoder doesn't match Sender: JSON PROTO3
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:657)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:645)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1324)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1161)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789)
	... 191 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [zipkin2.reporter.AsyncReporter]: Factory method 'spanReporter' threw exception with message: Encoder doesn't match Sender: JSON PROTO3
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
	... 205 common frames omitted
Caused by: java.lang.IllegalArgumentException: Encoder doesn't match Sender: JSON PROTO3
	at zipkin2.reporter.AsyncReporter$Builder.build(AsyncReporter.java:201)
	at org.springframework.boot.actuate.autoconfigure.tracing.zipkin.ZipkinConfigurations$ReporterConfiguration.spanReporter(ZipkinConfigurations.java:123)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139)
	... 206 common frames omitted

@JoeWang1127
Copy link
Contributor Author

Hi @codependent, here is the migration guide.

Feel free to file an issue if you have any questions. Thanks.

zhumin8 added a commit that referenced this pull request May 9, 2023
These are residual files from sample modules that are removed as part of #1287. They are unused and should be removed.
- `spring-cloud-gcp-pubsub-stream-polling-sample` is meant to be removed: #1287 (comment)
- `spring-cloud-gcp-pubsub-stream-sample` replaced by [functional sample](https://github.com/GoogleCloudPlatform/spring-cloud-gcp/tree/main/spring-cloud-gcp-samples/spring-cloud-gcp-pubsub-stream-functional-sample)
zhumin8 added a commit that referenced this pull request May 15, 2023
…ve sample. (#1851)

This pr cleans up setups in pom for `spring-cloud-gcp-data-firestore-sample` related to native support (configured with outdated `org.springframework.experimental:spring-native-configuration`). It reverts what's added for the sample in #508.
The relevant native support module has stopped working for a while and was deleted in #1287. So it should be safe to also remove these setups in sample.
zhumin8 added a commit that referenced this pull request Nov 27, 2023
This sample was removed as part of #1287
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet