diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/FragmentsRendering.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/FragmentsRendering.java index 7fcfcf5db34..d4a88bd3121 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/FragmentsRendering.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/FragmentsRendering.java @@ -68,7 +68,7 @@ public interface FragmentsRendering { * the shared model for the request. * @param viewName the name of the view for the fragment * @return this builder - * @since 6.2.1 + * @since 6.2.13 */ static Builder fragment(String viewName) { return new DefaultFragmentsRenderingBuilder().fragment(viewName); @@ -80,7 +80,7 @@ public interface FragmentsRendering { * @param model attributes for the fragment, in addition to attributes from the * shared model for the request * @return this builder - * @since 6.2.1 + * @since 6.2.13 */ static Builder fragment(String viewName, Map model) { return new DefaultFragmentsRenderingBuilder().fragment(viewName, model); @@ -91,7 +91,7 @@ public interface FragmentsRendering { * @param fragments the fragments to add; each fragment also inherits * attributes from the shared model for the request * @return the created builder - * @since 6.2.1 + * @since 6.2.13 */ static Builder fragments(Collection fragments) { return new DefaultFragmentsRenderingBuilder().fragments(fragments); @@ -102,7 +102,7 @@ public interface FragmentsRendering { * @param fragmentsPublisher the fragments to add; each fragment also * inherits model attributes from the shared model for the request * @return the created builder - * @since 6.2.1 + * @since 6.2.13 */ static

> Builder fragmentsPublisher(P fragmentsPublisher) { return new DefaultFragmentsRenderingBuilder(fragmentsPublisher); @@ -112,7 +112,7 @@ public interface FragmentsRendering { * Variant of {@link #fragmentsPublisher(Publisher)} that allows using any * producer that can be resolved to {@link Publisher} via * {@link ReactiveAdapterRegistry}. - * @since 6.2.1 + * @since 6.2.13 */ static Builder fragmentsProducer(Object fragmentsProducer) { ReactiveAdapter adapter = ReactiveAdapterRegistry.getSharedInstance().getAdapter(fragmentsProducer.getClass()); @@ -122,6 +122,52 @@ public interface FragmentsRendering { } + /** + * The same as {@link #fragment(String, Map)}. + * @deprecated in favor of {@link #fragment(String, Map)} + */ + @Deprecated(since = "6.2.13", forRemoval = true) + static Builder with(String viewName, Map model) { + return fragment(viewName, model); + } + + /** + * The same as {@link #fragments(Collection)}. + * @deprecated in favor of {@link #fragments(Collection)} + */ + @Deprecated(since = "6.2.13", forRemoval = true) + static Builder with(String viewName) { + return fragment(viewName); + } + + /** + * The same as {@link #fragments(Collection)}. + * @deprecated in favor of {@link #fragments(Collection)} + */ + @Deprecated(since = "6.2.13", forRemoval = true) + static Builder withCollection(Collection fragments) { + return fragments(fragments); + } + + /** + * The same as {@link #fragmentsPublisher(Publisher)}. + * @deprecated in favor of {@link #fragmentsPublisher(Publisher)} + */ + @Deprecated(since = "6.2.13", forRemoval = true) + static

> Builder withPublisher(P fragmentsPublisher) { + return fragmentsPublisher(fragmentsPublisher); + } + + /** + * The same as {@link #fragmentsProducer(Object)}. + * @deprecated in favor of {@link #fragmentsProducer(Object)} + */ + @Deprecated(since = "6.2.13", forRemoval = true) + static Builder withProducer(Object fragmentsProducer) { + return fragmentsProducer(fragmentsProducer); + } + + /** * Defines a builder for {@link FragmentsRendering}. */ @@ -180,7 +226,7 @@ public interface FragmentsRendering { * @param fragments the fragments to add; each fragment also inherits * attributes from the shared model for the request * @return this builder - * @since 6.2.1 + * @since 6.2.13 */ Builder fragments(Collection fragments); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/FragmentsRendering.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/FragmentsRendering.java index 9fc59f6a503..046426f866b 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/FragmentsRendering.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/FragmentsRendering.java @@ -59,7 +59,7 @@ public interface FragmentsRendering extends SmartView { * the shared model for the request. * @param viewName the name of the view for the fragment * @return the created builder - * @since 6.2.1 + * @since 6.2.13 */ static Builder fragment(String viewName) { return new DefaultFragmentsRenderingBuilder().fragment(viewName); @@ -71,7 +71,7 @@ public interface FragmentsRendering extends SmartView { * @param model attributes for the fragment, in addition to attributes from the * shared model for the request * @return the created builder - * @since 6.2.1 + * @since 6.2.13 */ static Builder fragment(String viewName, Map model) { return new DefaultFragmentsRenderingBuilder().fragment(viewName, model); @@ -82,13 +82,41 @@ public interface FragmentsRendering extends SmartView { * @param fragments the fragments to add; each fragment also inherits * attributes from the shared model for the request * @return the created builder - * @since 6.2.1 + * @since 6.2.13 */ static Builder fragments(Collection fragments) { return new DefaultFragmentsRenderingBuilder().fragments(fragments); } + /** + * The same as {@link #fragment(String, Map)}. + * @deprecated in favor of {@link #fragment(String, Map)} + */ + @Deprecated(since = "6.2.13", forRemoval = true) + static Builder with(String viewName, Map model) { + return fragment(viewName, model); + } + + /** + * The same as {@link #fragment(String)}. + * @deprecated in favor of {@link #fragment(String)} + */ + @Deprecated(since = "6.2.13", forRemoval = true) + static Builder with(String viewName) { + return fragment(viewName); + } + + /** + * The same as {@link #fragments(Collection)}. + * @deprecated in favor of {@link #fragments(Collection)} + */ + @Deprecated(since = "6.2.13", forRemoval = true) + static Builder with(Collection fragments) { + return fragments(fragments); + } + + /** * Defines a builder for {@link FragmentsRendering}. */ diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/DefaultFragmentsRenderingTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/DefaultFragmentsRenderingTests.java index 9be353d819c..a167a0570bc 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/DefaultFragmentsRenderingTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/DefaultFragmentsRenderingTests.java @@ -53,8 +53,7 @@ public class DefaultFragmentsRenderingTests { MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); - FragmentsRendering view = FragmentsRendering - .fragment("fragment1", Map.of("foo", "Foo")) + FragmentsRendering view = FragmentsRendering.fragment("fragment1", Map.of("foo", "Foo")) .fragment("fragment2", Map.of("bar", "Bar")) .header("headerName", "headerValue") .build();