Replace String literal with constant

Apache 2.0

Replace String literal with constant, adding import on class if needed.

org.openrewrite.java.ReplaceStringLiteralWithConstant

Required

Optional

The literal that is to be replaced. If not configured, the value of the specified constant will be used by default.

mod run . --recipe=org.openrewrite.java.ReplaceStringLiteralWithConstant \ -P fullyQualifiedConstantName=org.springframework.http.MediaType.APPLICATION_JSON_VALUE

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.