7.40.0 release (2023-04-21)
New Recipes
- org.openrewrite.java.cleanup.ShortenFullyQualifiedTypeReferences: Any fully qualified references to Java types will be replaced with corresponding simple names and import statements, provided that it doesn't result in any conflicts with other imports or types declared in the local compilation unit.
- org.openrewrite.java.dependencies.DependencyList: Emits a data table detailing all Gradle and Maven dependencies.This recipe makes no changes to any source file.
- org.openrewrite.java.migrate.apache.commons.lang.IsNotEmptyToJdk: Replace any
StringUtils#isEmpty(String)and#isNotEmpty(String)withs == null || s.isEmpty()ands != null && !s.isEmpty(). - org.openrewrite.java.spring.ChangeSpringPropertyValue: Change spring application property values existing in either Properties or Yaml files.
- org.openrewrite.java.spring.RenameBean: Renames a Spring bean, both declaration and references.
- org.openrewrite.java.spring.http.ReplaceStringLiteralsWithHttpHeadersConstants: Replace String literals with
org.springframework.http.HttpHeadersconstants. - org.openrewrite.java.spring.http.ReplaceStringLiteralsWithMediaTypeConstants: Replace String literals with
org.springframework.http.MediaTypeconstants. - org.openrewrite.java.spring.http.SpringWebDependency: Find compile scoped Spring Web dependency for Maven and Gradle, both direct and transitive.
- org.openrewrite.java.spring.security5.ReplaceGlobalMethodSecurityWithMethodSecurity:
@EnableGlobalMethodSecurityand<global-method-security>are deprecated in favor of@EnableMethodSecurityand<method-security>, respectively. The new annotation and XML element activate Spring’s pre-post annotations by default and use AuthorizationManager internally. - org.openrewrite.java.spring.security5.ReplaceGlobalMethodSecurityWithMethodSecurityXml:
@EnableGlobalMethodSecurityand<global-method-security>are deprecated in favor of@EnableMethodSecurityand<method-security>, respectively. The new annotation and XML element activate Spring’s pre-post annotations by default and use AuthorizationManager internally. - org.openrewrite.java.spring.security6.RemoveFilterSecurityInterceptorOncePerRequest: In Spring Security 6.0,
<http>defaultsauthorizeRequests#filterSecurityInterceptorOncePerRequestto false. So, to complete migration, any defaults values can be removed. - org.openrewrite.java.spring.security6.RemoveOauth2LoginConfig:
oauth2Login()is a Spring Security feature that allows users to authenticate with an OAuth2 or OpenID Connect 1.0 provider. When a user is authenticated using this feature, they are granted a set of authorities that determines what actions they are allowed to perform within the application. In Spring Security 5, the default authority given to a user authenticated with an OAuth2 or OpenID Connect 1.0 provider viaoauth2Login()isROLE_USER. This means that the user is allowed to access the application's resources as a regular user. However, in Spring Security 6, the default authority given to a user authenticated with an OAuth2 provider isOAUTH2_USER, and the default authority given to a user authenticated with an OpenID Connect 1.0 provider isOIDC_USER. These authorities are more specific and allow for better customization of the user's permissions within the application. If you are upgrading to Spring Security 6 and you have previously configured aGrantedAuthoritiesMapperto handle the authorities of users authenticated viaoauth2Login(), you can remove it completely as the new default authorities should be sufficient. - org.openrewrite.java.spring.security6.RemoveUseAuthorizationManager: In Spring Security 6,
<websocket-message-broker>defaults use-authorization-manager to true. So, the 'use-authorization-manager' attribute for message security is no longer needed and can be removed. - org.openrewrite.java.spring.security6.UpdateEnableReactiveMethodSecurity: In Spring security 6.0,
@EnableReactiveMethodSecuritydefaultsuseAuthorizationManagerto true. So, to complete migration,@EnableReactiveMethodSecurityremove theuseAuthorizationManagerattribute. - org.openrewrite.java.spring.security6.UpdateRequestCache: By default, Spring Security 5 queries the saved request on every request, which means that in a typical setup, the HttpSession is queried on every request to use the RequestCache. In Spring Security 6, the default behavior has changed, and RequestCache will only be queried for a cached request if the HTTP parameter "continue" is defined. To maintain the same default behavior as Spring Security 5, either explicitly add the HTTP parameter "continue" to every request or use NullRequestCache to override the default behavior.
- org.openrewrite.java.testing.junit5.UpgradeOkHttpMockWebServer: Migrates OkHttp 3
MockWebServerto the JUnit Jupiter compatible version. - org.openrewrite.xml.ChangeTagValue: Alters the value of XML tags matching the provided expression.
- org.openrewrite.yaml.AppendToSequence: Append item to YAML sequence.
- org.openrewrite.yaml.ChangePropertyValue: Change a YAML property. Nested YAML mappings are interpreted as dot separated property names, i.e. as Spring Boot interprets
application.ymlfiles.
Removed Recipes
- org.openrewrite.search.FindLanguageComposition: Produce a table of files and their language composition.
Changed Recipes
- org.openrewrite.github.AddCronTrigger was changed:
- Old Options:
cron: { type: String, required: true }
- New Options:
cron: { type: String, required: true }workflowFileMatcher: { type: String, required: false }
- Old Options:
- org.openrewrite.properties.ChangePropertyValue was changed:
- Old Options:
fileMatcher: { type: String, required: false }newValue: { type: String, required: true }oldValue: { type: String, required: false }propertyKey: { type: String, required: true }relaxedBinding: { type: Boolean, required: false }
- New Options:
fileMatcher: { type: String, required: false }newValue: { type: String, required: true }oldValue: { type: String, required: false }propertyKey: { type: String, required: true }regex: { type: Boolean, required: false }relaxedBinding: { type: Boolean, required: false }
- Old Options: