Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

SpringBoot2.1 upgrade 2.2.x Migration method

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains the "SpringBoot2.1 upgrade 2.2.x migration method", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "SpringBoot2.1 upgrade 2.2.x migration method"!

1. MediaType.APPLICATION_JSON_UTF8_VALUE = = > MediaType.APPLICATION_JSON_VALUE

MediaType.APPLICATION_JSON_UTF8_VALUE has been marked @ Deprecated

A string equivalent to {@ link MediaType#APPLICATION_JSON_UTF8}. Deprecated has not been recommended since Spring Framework 5.2, but it is recommended to use {@ link # APPLICATION_JSON_VALUE} because major browsers (such as Chrome) now conform to the specification and correctly interpret that the UTF-8 special character does not require the {@ code charset = UTF-8} parameter.

2. An outdated and new alternative to org.springframework.data.domain.Sort:

Previously written: Sort sort = new Sort (Sort.Direction.DESC, "taskId"); how to replace it?

Now it is written: Sort sort = Sort.by (Sort.Direction.DESC, "taskId"); reason: private Sort (Direction direction, List properties) is an internal constructor and cannot be used externally, and Sort.by (Direction direction, List properties) is used externally.

How to configure on when 3.Actuator HTTP Trace and Auditing are disabled by default is off by default

The Actuator HTTP Trace and Auditing features are not enabled by default anymore, since the default repositories implementations are in-memory and may consume too many resources and are not cluster friendly For robust, production-grade HTTP tracing we recommend the use of Spring Cloud Sleuth or similar.

To enable HTTP tracing, contribute a bean implementing HttpTraceRepository or AuditEventRepository to turn those features back on. Configuration properties are available to turn those features off even in the presence of those beans (see management.auditevents.enabled and management.trace.http.enabled)

4.Lazy initialization

It is now possible to enable global lazy initialization to reduce startup time via the spring.main.lazy-initialization property. Please note that using that feature comes at a cost:

Handling of HTTP requests may take longer while any deferred initialisation occurs

Failures that would normally occur at startup will now not occur until later

Individual beans can opt out of lazy initialization by annotating their definition with @ Lazy (false). Where it is not possible to use @ Lazy (false) to opt out of lazy initialization, a LazyInitializationExcludeFilter bean can be used instead. For example, to never set IntegrationFlow beans to lazy, you can use the following code:

@ Bean static LazyInitializationExcludeFilter integrationLazyInitExcludeFilter () {return LazyInitializationExcludeFilter.forBeanTypes (IntegrationFlow.class);}

Enhancement of 5.Reactor responsive programming transaction support

Reactive Elasticsearch Auto-configuration

How does 6.Spring Boot let Web API generate documents automatically and solve the problem of discarding the description attribute of swagger-annotations 's API annotations?

Https://blog.csdn.net/zhangchao19890805/article/details/54863338

Old: @ Api (description= "Archive")

New: @ Api (tags= {"Archive"})

JMX now disabled by default

As of # 16090, JMX is not enabled by default anymore. This feature can be enabled with the configuration property spring.jmx.enabled=true. If you're using IDE features to administer your applications, you may want to enable that flag there as well.

7.BlogServerApplication: Failed to retrieve application JMX service URL

8.@ConfigurationProperties scanning

Dependency Upgrades Spring Boot 2.2 moves to new versions of several Spring projects:

Reactor Dysprosium

Spring AMQP 2.2

Spring Batch 4.2

Spring Data Moore

Spring Framework 5.2

Spring HATEOAS 1.0

Spring Integration 5.2

Spring Kafka 2.3

Spring Security 5.2

Spring Session Corn

Numerous third-party dependencies have also been updated, some of the more noteworthy of which are the following:

Artemis 2.9

Elasticsearch 6.7

Flyway 6.0

Git Commit ID Plugin 3.0

Hazelcast 3.12

HSQLDB 2.5

Jackson 2.10

Jedis 3.1

Jersey 2.29

Kafka 2.3

Lettuce 5.2

Micrometer 1.3

Mockito 3.1

Solr 8.0

Miscellaneous Apart from the changes listed above, there have also been lots of minor tweaks and improvements including:

LoadOnStartup can be configured if you're wrapping a Servlet as an actuator endpoint.

Flyway bootstrap failures are covered by a dedicated FailureAnalyzer

The MessageConverter for Kafka batch listeners is properly auto-configured.

Add support for Jaybird 4 (jdbc:firebird prefix).

Add opt-in support for Neo4j-OGM native types.

Client-side HTTP-metrics have an outcome tag.

Numerous upgrades of third-party dependencies

Prometheus push gateway can now be configured using https

Printer and Parser beans are automatically registered with the application conversion service.

When using the H2 console auto-configuration, JDBC connection URL is now logged at startup for ease of connection.

Couchbase role-based access is now supported via spring.couchbase.username and spring.couchbase.password.

Support for OAuth3 resourceserver opaquetoken authentication has been added and can be configured using the spring.security.oauth3.resourceserver.opaquetoken configuration properties.

The application will fail fast if spring.config.location specifies a file with an extension that no PropertySourceLoader can read.

The layout to use to repackage the application can be set on the command line with Maven using the spring-boot.repackage.layout property.

RestTemplateBuilder#defaultHeader accepts more than one value.

Custom resource handlers can serve a favicon.

Kafka's RecordInterceptor is detected and associated to the auto-configured listener container.

YAML configuration can now use on or off for boolean types.

Actuator discovery page is now available on / when using a separate management port.

@ WebMvcTest now scans HandlerInterceptor beans.

@ WebFluxTest scans WebFilter beans.

Configurable timeout for JMS listener container's receive.

Support for Spring Session's flush mode.

Support for Spring AMQP's confirm-type.

Application properties for configuring Jetty's thread pool.

Support for parallel test execution when using @ AutoConfigureMockMvc with JUnit 5.

Zip64 files are now supported inside "Fat Jars".

The ROLLING_FILE_LOG_PATTERN is now exposed for use in logback configurations.

You can now inject and use a customized WebTestClient in any @ SpringBootTest.

Dependency management for Oracle's JDBC driver has been added.

Dependency management for Awaitility has been added.

Deprecations in Spring Boot 2.2 The logging.file property has been renamed to logging.file.name.

The logging.path property has been renamed to logging.file.path.

The server.connection-timeout property has been deprecated in favor of server-specific properties since their behaviors are not strictly the same.

The server.use-forward-headers property has been deprecated in favor of server.forward-headers-strategy; previously server.use-forward-headers=true would use the web server native support. You can now achieve the same with server.forward-headers-strategy=native. Because each server has a specific behavior, we now offer an alternative which relies on Spring's ForwardedHeaderFilter: server.forward-headers-strategy=framework. Developers should use the option that fits best their use case.

ReactiveWebServerApplicationContext#getWebServerFactory.

The agent property of the Maven plugin has been renamed to agents.

Joda time support is deprecated in favour of java.time.

ApplicationHealthIndicator in favour of PingHealthIndicator that is always contributed.

ConfigurationBeanFactoryMetadata in favour of ConfigurationPropertiesBean.

ConfigurationPropertiesBindingPostProcessor constructors in favor of @ EnableConfigurationProperties or the register method.

ConfigurationPropertiesBindingPostProcessor.VALIDATOR_BEAN_NAME has moved to EnableConfigurationProperties.VALIDATOR_BEAN_NAME.

ConfigurationPropertiesBindingPostProcessorRegistrar in favor of @ EnableConfigurationProperties.

WebTestClientBuilderCustomizer has been relocated to org.springframework.boot.test.web.reactive.server.

Referenc

Spring-Boot-2.2-Release-Notes

Thank you for your reading, the above is the content of "SpringBoot2.1 upgrade 2.2.x migration method". After the study of this article, I believe you have a deeper understanding of the problem of SpringBoot2.1 upgrade 2.2.x migration method, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 271

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report