jamesfredley commented on code in PR #15957: URL: https://github.com/apache/grails-core/pull/15957#discussion_r3591266352
########## grails-spring/src/main/groovy/grails/spring/BeanBuilderBeanRegistryAdapter.java: ########## @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package grails.spring; + +import java.util.Map; + +import groovy.lang.Closure; + +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; + +/** + * BeanRegistryAdapter backed by the existing BeanBuilder implementation. + * + * @since 8.1 + */ +public class BeanBuilderBeanRegistryAdapter implements BeanRegistryAdapter { + + private final BeanBuilder beanBuilder; + + public BeanBuilderBeanRegistryAdapter() { + this(new BeanBuilder()); + } + + public BeanBuilderBeanRegistryAdapter(BeanBuilder beanBuilder) { + this.beanBuilder = beanBuilder; + } Review Comment: Addressed in 0a1f09df85. The `BeanBuilderGrailsBeanRegistryAdapter(BeanBuilder)` constructor now calls `Assert.notNull(beanBuilder, "The argument [beanBuilder] cannot be null")`, matching how `BeanBuilder` guards its own public entry points. A `adapterRejectsNullBeanBuilder` test covers it. ########## grails-spring/src/main/groovy/grails/spring/BeanRegistryAdapter.java: ########## @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package grails.spring; + +import java.util.Map; + +import groovy.lang.Closure; + +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; + +/** + * Experimental adapter seam for the BeanBuilder to Spring BeanRegistrar transition. + * + * @since 8.1 + */ +public interface BeanRegistryAdapter { Review Comment: Addressed in 0a1f09df85. Renamed the interface to `grails.spring.GrailsBeanRegistryAdapter` and the implementation to `BeanBuilderGrailsBeanRegistryAdapter` to avoid the collision with Spring's `org.springframework.beans.factory.support.BeanRegistryAdapter`. The test, docs, and TOC were updated to match; a repo grep confirms no remaining references to the old names. ########## grails-spring/src/main/groovy/grails/spring/GrailsBeanRegistryAdapter.java: ########## @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package grails.spring; + +import java.util.Map; + +import groovy.lang.Closure; + +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.support.BeanDefinitionRegistry; + +/** + * Experimental adapter seam for the BeanBuilder to Spring BeanRegistrar transition. + * + * @since 8.1 + */ Review Comment: Addressed in 0a1f09df85. Aligned `@since` to `8.0.x` on both types and reworded the guide from "Grails 8.1" to "Grails 8.0", matching the target branch. ########## grails-doc/src/en/guide/upgrading/beanRegistryAdapter.adoc: ########## @@ -0,0 +1,7 @@ +=== BeanBuilder to BeanRegistry strategy + +Grails 8.1 introduces an experimental `grails.spring.BeanRegistryAdapter` seam as the first step toward the Spring 7 `BeanRegistrar` direction tracked in issue #15824. +The initial `BeanBuilderBeanRegistryAdapter` delegates to the existing `BeanBuilder`, so `resources.groovy`, plugin `doWithSpring`, and existing BeanBuilder APIs continue to work unchanged. + +The intended migration path is to move call sites behind the adapter first, then add a Spring 7 BeanRegistrar-backed implementation once the framework integration points are ready. +BeanBuilder is not removed or behaviorally changed by this seed. Review Comment: Addressed in 0a1f09df85. Added the standard ASF license header block (copied from `upgrading80x.adoc`) to the new `beanRegistryAdapter.adoc`, and softened the misleading "tracked in issue #15824" wording to "See PR #15824 for related work". A follow-up commit (a20c06fc82) also corrected the BeanRegistrar/BeanRegistry wording per a reviewer note. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
