Repository navigation
Merge 8.1.x into 9.0.x - #17156
Merged
Merged
Merge 8.1.x into 9.0.x#17156
Conversation
GrailsCacheManagerAware, which GrailsCacheAdminService and every class with a cached method implement, autowired one CacheManager. With a second one in the context the injection was ambiguous, and Spring's fallback of matching the field's name did not help, as a trait's field is renamed in the class that implements it. So an application with the cache plugin, which grails-dependencies-starter-web brings in, failed to start once anything else defined a CacheManager, as the Spring Security plugin does with cacheUsers. The trait now takes every cache manager by bean name and uses the one named grailsCacheManager, or where there is none the only one there is, as before. Several and none of that name leave it without one rather than failing startup.
… one 621a2a8 took the bean named grailsCacheManager, or the only cache manager. With several, one marked primary and none of that name, as with caching auto-configuration off, it found none, where the injection it replaced used the primary one, so cache annotations neither cached nor evicted. With the plugin's manager there too, it also took that one over an application's own manager marked primary. The trait now asks Spring first, through an ObjectProvider: the only cache manager, or the one marked primary. The bean named grailsCacheManager is used only where Spring cannot choose, which is the case that failed startup. So every context that started before gets the cache manager it had.
210ee4d asked Spring for the only or primary cache manager first, so with the plugin's grailsCacheManager and another cache manager marked primary, cache annotations used the other one. The plugin creates its caches in grailsCacheManager and its tag library is wired to it by name, so the annotations now use it too: the bean of that name first, and the only or primary cache manager where there is none of that name.
Injecting every cache manager by name created each of them when a cache-aware bean was, including one declared lazy that the injection this replaced never created, so a lazy cache manager whose store was down failed startup. The trait now looks the cache manager up in the bean factory when it is first asked for: grailsCacheManager by name, or the only or primary one through the bean provider. Both work from the bean definitions, and only the cache manager returned is created.
…injection The lookup reimplemented Spring's choice through the bean provider, and a matrix of every arrangement of cache managers against what Spring injected into the trait's old field found 16 that differed: a cache manager that is not an autowire candidate, or not a default one, was used where the injection used none or another; a fallback lost to a non-default one; and two primary or two equally high priority cache managers threw on the first cached call instead of failing startup as before. GrailsCacheManagerLookup now takes grailsCacheManager by name, as the plugin and its tag library do, and otherwise resolves the dependency with Spring's own resolveDependency, against an injection point like the trait's old field, so every other choice is the injection's. Where Spring cannot choose there is no cache manager, and a warning names the class and the cache managers. The trait looks up once, so a lookup that finds none is not repeated on every cached call. GrailsCacheManagerLookupMatrixSpec runs 342 arrangements, each in a context of its own against a bean with the old injection, and checks which cache manager is used and that none is created the injection would not have created.
…s fields The lookup added fields to GrailsCacheManagerAware. A trait's fields are compiled into each class that implements it, so a class compiled against 8.0.0, such as a cached service in a plugin, lacked them, and the new trait's code threw AbstractMethodError on every cached call where no cache manager had been injected. The lookup also ran on the first call, unsynchronised, so a concurrent first call could see no cache manager, and failures moved from startup to every call. The trait keeps exactly its 8.0.0 fields. Its field is no longer injected; an @Autowired method sets it when the bean is created, from the BeanFactory and an ObjectProvider<CacheManager>, as the injection did. A class compiled against 8.0.0 keeps injecting its own field. Without one named grailsCacheManager, the cache manager is the provider's getIfAvailable, which is Spring's injection resolution for the method's own parameter and bean. Where Spring cannot choose, the warning gives Spring's reason, and a primary cache manager passed over for grailsCacheManager is logged once at INFO level. A spec compiles a cached class against the 8.0.0 trait and loads only that class beside this one; against the previous lookup it fails with AbstractMethodError. The cache guide and section 94 of the upgrade guide describe which cache manager is used.
…rity too The cache manager was taken with getIfAvailable, which answers null for a scoped cache manager whose scope is not active, where the injection failed the bean; it is now taken with getObject, with none and Spring not choosing handled as before. The bean factory is taken through a provider, as a bean factory that is not an application context does not inject itself, and Spring skipped the method there, leaving no cache manager where the field was injected. The report of a cache manager passed over for grailsCacheManager now counts one Spring prefers by priority as well as primary, looks in parent contexts, leaves out beans Spring would not inject, and scans once for each bean factory. The guide says the plugin, not the application, defines no grailsCacheManager with caching off, and section 94 says that a plugin compiled against 8.0.0 still fails beside a second cache manager until it is recompiled, and that one compiled against this version needs it at runtime.
The report of a cache manager passed over read the bean definition of every cache manager, and one registered as a singleton has none, so the lookup threw and every cache-aware bean failed while INFO was enabled. A cache manager without a definition is now judged by the priority of its class, as Spring judges it, the factory is marked as reported before the scan, and anything the scan meets is logged at DEBUG level instead of failing the bean. Where Spring cannot otherwise choose, it takes the bean named like the parameter, which the trait's renamed field never matched. The injection method's parameters are now named as no bean would be; with the earlier names, a cache manager named cacheManagers was chosen where Spring otherwise could not choose. The spec compiles its class keeping parameter names, as the Grails Gradle plugin compiles an application. Section 94 says that grailsVersion makes Grails warn rather than stop, and that an 8.0.0 plugin's cached class fails beside a second cache manager unless one of them is primary.
The report's comment claimed more than its catch covers, the parameter javadoc said a bean named like a parameter is taken only where Spring cannot otherwise choose, where it is taken over one of a higher priority too, and section 94 now counts a priority, as well as primary, as what lets an 8.0.0 plugin's cached class be created beside a second cache manager.
A cache manager answers null for a cache name it has no cache of, as JCacheCacheManager does for a cache it was not configured with, and the code the cache annotations generate called the cache without checking, so every call failed with a NullPointerException. That is what happened with caching off and the Spring Security plugin's cacheUsers cache manager the only one, and with any such cache manager as grailsCacheManager. What follows the cache lookup now runs only where there is a cache: a @Cacheable or @cACHEpUT method otherwise runs as it does without a cache manager, and @CacheEvict has nothing to evict. GrailsCacheManagerLookup.reportMissingCache logs a warning naming the class and the cache once for each cache manager and name. Classes compiled against this version get it; those compiled against 8.0.1 already need 8.0.1 for the trait. MissingCacheSpec drives annotated classes, compiled statically and dynamically, against a cache manager with one named cache; with the previous generated code both fail with the NullPointerException.
The compatibility feature compiled through the output phase, which wrote the 8.0.0 trait's and the fixture's class files into the module's working directory. It now stops at class generation and takes the classes from the compilation unit.
The trait method chose grailsCacheManager over a cache manager Spring would have preferred, so an application that starts on 8.0.0 with a primary or @priority cache manager of its own would move its caches in a patch release, and classes compiled against 8.0.0 still failed beside a second cache manager. The trait is 8.0.0's again. GrailsCacheManagerAliasRegistrar, a bean factory post-processor of the plugin's auto-configuration, gives the bean named grailsCacheManager the name the trait's field has in each class that implements it. Spring falls back to that name only where it cannot otherwise choose, so the cacheUsers case now gets grailsCacheManager, for classes compiled against 8.0.0 too, and a primary cache manager is still used. A @priority cache manager beside grailsCacheManager is the one choice that changes. The missing-cache report moves to MissingCacheReporter. GrailsCacheManagerAliasMatrixSpec runs 342 arrangements against 8.0.0, the same class in the same context without the alias. MissingCacheSpec creates the annotated class as a bean beside a second cache manager and covers a key closure. The guide, section 94 and the Grails 8 upgrade skill describe it.
8.0.x now lists the upgrade guide's changes by release and moved the Grails 8 upgrade skill to the grails-upgrade skill, leaving grails-8-upgrade a pointer to it. The cache section becomes an unnumbered section under Grails 8.0.1 after the two Spring Security REST sections 8.0.x added there, grails-8-upgrade is taken as 8.0.x has it, and the cache entry moves to the Grails 8.0.1 part of grails-upgrade.
The alias registrar's javadoc says a grailsCacheManager the application or a cache provider plugin defines gets the alias too, but only the matrix, which adds the registrar by hand, checked it. A feature of CacheAutoConfigurationSpec now defines one beside a second cache manager and checks, through the plugin's auto-configuration, that a cache-aware bean and GrailsCacheAdminService get it. Without the registrar it fails with the startup error the fix is for.
…rity Spring takes a bean named like the field before one with a higher priority, so with the alias grailsCacheManager beat a @priority cache manager Spring had injected in 8.0.0. Where the application's grailsCacheManager is created from a cache-aware bean, that bean then asked for grailsCacheManager while it was being created, and startup failed; 8.0.0 started and injected the @priority one. The registrar now registers the alias only where no other cache manager is marked primary or has a priority, read from the bean definitions, or for a singleton without one from its class, so Spring keeps its 8.0.0 choice there, and grailsCacheManager is taken only where 8.0.0 could not choose. That also drops the one choice 8.0.1 changed, and its upgrade note. The matrix gains a grailsCacheManager created from the cache-aware bean, and expects 8.0.0's result except where 8.0.0 failed with no preferred cache manager; with the previous registrar, 11 such rows beside a @priority cache manager fail to start. CacheAutoConfigurationSpec covers the case through the auto-configuration, with a @priority and a primary cache manager.
The registrar reads the priority of the other cache managers from the types their definitions declare, as it runs before any bean exists. A factory method declared to return a CacheManager hides the priority of the object it returns, which Spring reads once that bean exists, so where such a cache manager was created before the first cache-aware bean, 8.0.0 injected it, and with the alias grailsCacheManager was taken instead. A grailsCacheManager created from a cache-aware bean then asked for itself while it was being created, and startup failed. With the alias, the registrar now adds a bean post-processor that runs the check again before the first cache-aware bean is injected, when the cache managers created by then have the type of their object, and removes the alias where one of them has a priority. It creates no bean, and it decides once, so every cache-aware bean gets the cache manager the first one gets. The matrix gains a cache manager declared as CacheManager whose object has a priority, so 511 arrangements; with the previous registrar, 24 of them got grailsCacheManager where 8.0.0 got that one. CacheAutoConfigurationSpec covers the startup failure with such a cache manager created first.
…of the alias The alias of grailsCacheManager made Spring take it by name before a cache manager with a higher priority, and the registrar's checks of the other cache managers' priorities ran before Spring chose: at bean factory post-processing, and before the first cache-aware bean was injected. A cache manager created later than that, as by a key generator injected into the same bean before its cache manager, or the product of a factory bean that names only CacheManager as its type, has a priority Spring sees when it chooses and the checks did not. There grailsCacheManager was taken where 8.0.0 took the other one, and a grailsCacheManager created from the cache-aware bean then asked for itself and failed startup. There is no alias now. GrailsCacheManagerFallback wraps the bean factory's autowire candidate resolver. When Spring resolves the trait's field, the resolver first runs Spring's own resolution of it, with a descriptor that creates no cache manager Spring would not create to compare them and that notes where Spring cannot choose. Where Spring can choose, the resolver steps aside and Spring resolves the field as it did, at that moment; only where Spring cannot choose and grailsCacheManager is one of the cache managers it cannot choose between is the field given grailsCacheManager. Any other injection of a cache manager is left alone. GrailsCacheManagerFallbackMatrixSpec, renamed from the alias matrix, gains a factory bean whose product has a priority and a cache manager with a priority that the key generator creates, so 777 arrangements; with the alias registrar 67 of them differed from 8.0.0. It also covers singletons without a bean definition, a cache manager injected into a field of the application's own, which still fails where Spring cannot choose, and installing the resolver once. CacheAutoConfigurationSpec covers both of the new cases through the auto-configuration, with a grailsCacheManager created from the cache-aware bean; both failed to start with the alias registrar.
…che-manager-8.0.x
The fallback resolved the trait's field twice: a probe of Spring's own resolution without the requesting bean, then, where Spring could choose, the injection's own, and where it could not, the fallback's value through getSuggestedValue. Without the requesting bean, the probe did not leave the bean out of its own candidates, so a grailsCacheManager that is cache-aware itself was injected into itself, or with circular references disallowed failed to start, where 8.0.0 gave it the other cache manager. A factory bean of new cache managers made one for the probe and another for the injection. A suggested value is returned before Spring records the bean it injects, so the cache-aware bean was not registered as depending on grailsCacheManager, and could stop after it. The resolver now answers the field from getLazyResolutionProxyIfNecessary, which Spring asks with the requesting bean right before it would resolve the field, with the field's one resolution: Spring's doResolveDependency for that bean, with a descriptor that takes grailsCacheManager where Spring cannot choose. It registers the bean as depending on the cache managers that resolution took, as the injection registers it. The matrix gains a grailsCacheManager that is cache-aware itself and a factory bean of new cache managers, so 1,064 arrangements, and each row now also checks what such a grailsCacheManager gets, the beans the cache-aware bean depends on, and how many of each cache manager are created; with the previous fallback 233 rows failed them. CacheAutoConfigurationSpec covers a cache-aware grailsCacheManager with circular references allowed and disallowed, and the stop order of a cache-aware bean given grailsCacheManager.
…che-manager-8.0.x
GrailsOpenSessionInViewInterceptor.preHandle opens the default session through Spring, then a session for each other datasource. Spring calls afterCompletion only on interceptors whose preHandle completed, so when opening a later datasource's session threw, the sessions already opened stayed bound to the thread. Hibernate opens a session without taking a connection, so this happens when a session factory is closed, as during shutdown. preHandle now closes the sessions it opened for the other datasources, counts down those it joined, and releases the default session through Spring's afterCompletion. It then rethrows the original failure, with any failure to release attached to it as suppressed.
GrailsOpenSessionInViewInterceptor.preHandle opens the default session through its parent, then a session for each other datasource. Spring calls afterCompletion only on interceptors whose preHandle completed, so when opening a later datasource's session threw, the sessions already opened stayed bound to the thread. Hibernate opens a session without taking a connection, so this happens when a session factory is closed, as during shutdown. preHandle now closes the sessions it opened for the other datasources, counts down those it joined, and releases the default session through the parent's afterCompletion. It then rethrows the original failure, with any failure to release attached to it as suppressed.
…tion does After a field's first resolution picks one bean, Spring's injection remembers that bean's name and resolves the field by it from then on, so a prototype bean's next instances only fetch that bean. The fallback answers the trait's field itself, so Spring recorded no bean and kept only the descriptor, and every instance resolved the field afresh: a factory bean of new cache managers among the candidates made one for each instance, where 8.0.0 made one for the first. The resolver now remembers, by bean name and injection point, the cache manager the field took, where the injection would remember it: one bean, of the field's type. A later resolution of that field takes it by name, as long as it is still there and of that type. The matrix also creates three instances of a prototype cache-aware bean in each arrangement, and checks what they get and the cache managers they create against 8.0.0; with the previous fallback 113 rows created more. Two features pin a factory bean of new cache managers beside a primary grailsCacheManager and beside one Spring cannot choose against. The count of what each arrangement created now counts every creation, where a list difference dropped the repeats of a cache manager created at startup.
When setting a new session's flush mode or binding it threw, the session was not bound yet, so the release of what preHandle acquired did not find it and left it open. Close it before rethrowing, so the release then frees the sessions opened before it.
When setting a new session's flush mode or binding it threw, the session was not bound yet, so the release of what preHandle acquired did not find it and left it open. Close it before rethrowing, so the release then frees the sessions opened before it.
The resolver remembered the cache manager a bean's field took, by bean name and injection point, for as long as the bean factory lived. Spring's injection forgets its own record when a bean definition is registered again or removed: the bean factory resets the definition, and AutowiredAnnotationBeanPostProcessor drops the bean's injection metadata, so the bean's fields are resolved afresh. After a reload that registered the bean again beside a new cache manager marked primary, the bean still got the cache manager it had before. The resolver is now a MergedBeanDefinitionPostProcessor too, added to the bean factory with it, and forgets what a bean's fields took when that bean's definition is reset, as the injection does. A feature injects a prototype, adds a cache manager marked primary, and registers the prototype again, where Spring chooses grailsCacheManager and where the fallback does: the choice is kept until the prototype is registered again and then made afresh, as in 8.0.0. With the previous resolver both kept grailsCacheManager.
…de fails openSession() opened the default session and then applied the flush mode. When that threw, the session was not bound yet, so nothing closed it. Close it before rethrowing, as for the sessions of the other datasources.
…de fails openSession() opened the default session and then applied the flush mode. When that threw, the session was not bound yet, so nothing closed it. Close it before rethrowing, as for the sessions of the other datasources.
Where two first calls for a cache manager both found no set of reported names, the second was given the set the first had published, still empty, and Groovy's Elvis operator took that empty set for none and kept its own unpublished set, so both reported the missing cache. The set the map holds is now used whenever there is one. MissingCacheSpec reports a missing cache from eight threads at once for each of 300 cache managers; with the previous reporter it logged 306 warnings.
… it injects The registrar decided which members to take over with a processor of its own in Spring's default configuration, and left a member to the post-processors before Spring's by its annotations. A member Spring's injection as the application configured it ignores, as a @value method with only @Autowired recognized, was injected; one annotated for both @resource and @Autowired, without the processor for @resource, ran before the field. It also served only instances whose definition Spring had processed for their class: an instance given to autowireBean, as GORM does for each data service, or a prototype whose supplier makes another class, Spring injected afresh, the field the plain way beside a second cache manager, and the third instance of A, B, A twice. Where code generated ahead of time ran, it took nothing over, so what Grails' processor injected there, a bean registered as the context starts among them, was resolved through the resolver and not remembered by name, and the resolver also answered the shortcut the take-over remembers. The name grailsCacheManager was matched against a candidate's aliases from any factory, though a child factory had a bean of that name of its own. The registrar now learns the members and their order from Spring's injection as configured, and the members others take from replaying the post-processors before it, and Grails' marking of generated members, on a copy of the definition. Right before Spring's injection of an instance with no plan for its class, it plans for that class and gives Spring's injection the members to leave out. It runs where generated code runs too, and the resolver answers only the plain descriptor the generated code resolves with. The bean the name stands for is the one in the nearest factory that has one. The matrix spec covers each case against 8.0.0: Spring's injection for @Autowired only, a method annotated for both without the processor for @resource, autowireBean and autowireBeanProperties, a prototype supplier of A, B and A, a bean registered beside generated beans with Grails' processors that keeps its cache manager when a primary one is added, and a parent factory's alias, visible and shadowed by the child. Each failed with the previous registrar. The rows also check that each initializer ran once on each instance.
The cache guide, the upgrade note and the grails-upgrade skill said the annotations use grailsCacheManager wherever Spring cannot choose. Two cache managers both marked primary, or sharing the highest priority, still fail, as Spring rejects them before it looks further; all three now say so, and what to do about it.
…ilure-7.0.x # Conflicts: # grails-data-hibernate5/grails-plugin/src/main/groovy/org/grails/plugin/hibernate/support/GrailsOpenSessionInViewInterceptor.java
…sion through setHibernateDatastore The test of a later datasource whose new session refuses its flush mode added that datasource to the interceptor's private list through reflection. It now passes the interceptor a datastore whose connections are the default, the secondary and the refusing one, through setHibernateDatastore, as an application configures it.
…rent class sets on it fails Spring's OpenSessionInViewInterceptor.openSession() sets the MANUAL flush mode on the session it opens, and does not close the session when that fails, so the session was neither closed nor bound. openSession() now opens the session itself, as the parent class does, and closes it when setting either flush mode fails. A HibernateException is still thrown as the parent class throws it, wrapped in a DataAccessResourceFailureException.
…, as Spring does 8182ed6 named the default session's participation attribute, which the parent also registers the request's asynchronous interceptors under, after the factory itself. LocalSessionFactoryBuilder's background bootstrap returns an InfrastructureProxy that compares by identity, so the proxy and its target got different names, though TransactionSynchronizationManager unwraps the proxy and binds their sessions under one key. A Callable redispatched through an interceptor holding the other of the two found no registered interceptor: it opened a second session, and completion closed only that one. Both identity maps, the default factory's attribute names and the other datasources' participation counts, are now keyed by the factory as TransactionSynchronizationUtils.unwrapResourceIfNecessary takes it. MultiDataSourceSessionSpec redispatches between the real bootstrap proxy and its target, both ways.
…d when the request completes without a dispatch The Hibernate 5 counterpart of a64ebcc on 7.0.x. When a request goes asynchronous without Grails marking it, the interceptor leaves the default session to the parent class, which unbinds it and leaves closing it to the asynchronous interceptors it registers, which close it in the dispatch that a Callable or DeferredResult starts. A request that completes without that dispatch left the session open. The interceptor now also closes that session when the asynchronous request completes, unless it is closed by then. On 8.0.x a task the action starts and does not return is marked by WebPromises, so it already took the path that closes the session on completion; the OsivRequestSessionSpec feature ported with the fix passes either way and guards that path. The Spring feature of MultiDataSourceSessionSpec now expects both sessions closed when the request completes without a dispatch, and fails without the change.
…tch factories by identity The Hibernate 5 counterpart of the fixes apache#17087 made to the Hibernate 7 interceptor after the parent's MANUAL step (eb8a3a3 here). Each one reproduces on 7.0.x: 21 of the 28 features ported with them fail without this change. - Any failure, not only a RuntimeException or an Error, closes a session whose setup fails and releases what preHandle acquired: Groovy code can throw a checked exception it does not declare. - A holder bound for a factory while its new session is set up is left as it is, and the new session closed, since Spring's bindResource replaces it before it throws. - A failure to close a session is attached to the failure being thrown, instead of being logged by SessionFactoryUtils: after a failed preHandle, after a failed setup, next to a failed flush as the request goes asynchronous (on the UndeclaredThrowableException thrown for a checked one), and in afterCompletion with the failure Spring passes it and throws on afterwards. A failure is never attached to itself, so two flushes failing with one exception, in postHandle or as the request goes asynchronous, no longer stop the release, and one that cannot be attached is logged. - Each step of releasing a session runs even when an earlier one fails, a holder something else took off is not unbound again, and releasing the default session no longer throws in place of the flush failure. - Which sessions a request found bound is recorded by the identity of their factory, not by its toString(): SessionFactoryImpl does not override it, so two factories could print the same and share a count, and the release closed the joined session and left the opened one bound. Both identity maps take the factory as TransactionSynchronizationManager does, unwrapping an InfrastructureProxy, so a factory bootstrapped in the background and its target stay one factory, and the default factory's name, under which Spring also registers the request's asynchronous interceptors, is shared by every interceptor using it. The failure tests now throw from small Groovy session and factory classes, which Spock mocks would wrap, and register them through setHibernateDatastore. slf4j-simple joins the test runtime, as on 8.0.x, so that the logged failure to close can be checked.
8.0.x's merge-up of 7.2.x (95b69f3) ported a64ebcc to the Hibernate 7 interceptor, the same guard 5d9ff5d added here: the default session Spring takes off the thread is closed when the request completes without a dispatch. Conflicts resolved: - GrailsOpenSessionInViewInterceptor: one copy of the guard, inside this branch's releaseDefaultSessionAsAsyncStarts, closing through closeSessions(sessions, null). The javadoc of afterConcurrentHandlingStarted takes 8.0.x's text and keeps this branch's paragraph on flush failures; it leaves out the task the action does not return, which WebPromises marks on 8.0.x, so it does not take that path. - MultiDataSourceSessionSpec: keeps this branch's deferred-close test, and its wording of the Spring feature's when-block for the same reason. The example controller and spec merged without a conflict, with one copy of the ported action and feature.
Merge 7.0.x into 7.1.x
Merge 7.1.x into 7.2.x
Merge 7.2.x into 8.0.x
Merge 8.0.x into 8.1.x
…ailure-7.0.x fix(hibernate5): release what preHandle acquired when it fails partway
Merge 7.2.x into 8.0.x
…ailure-8.0.x fix(hibernate7): release what preHandle acquired when it fails partway
The fallback took the trait's field over from Spring's injection and injected it, and every member Spring injects after it, itself, which meant reproducing Spring's field injection, its order of members, the ownership of members between its post-processors, the instances it injects without a processed definition, and its generated injection. Each review round found another part of that copy, and a Spring patch that changes any of it could break the injection of every cached service, where Spring's own injection already does all of it. GrailsCacheManagerAliasRegistrar, as it was at 4d4da50, is back: it gives grailsCacheManager the trait field's name as an alias, unless another cache manager is marked primary or has a priority on its definition, and Spring takes it by that name where it could not otherwise choose, on every path it injects, generated code included. GrailsCacheManagerFallback is gone. The one difference from 8.0.0 the alias leaves: a cache manager whose priority only its object has, from a factory method or FactoryBean declared as a plain CacheManager, is not seen, so Spring takes grailsCacheManager by name before it, where 8.0.0 chose that one if it had been created first. A grailsCacheManager created from a cache-aware bean is then asked for while it is created, and the context does not start. The cache guide, the upgrade note and the grails-upgrade skill say to mark such a cache manager primary to keep it. GrailsCacheManagerAliasMatrixSpec, renamed from the fallback's, keeps 8.0.0 as its oracle over the same 1,596 arrangements and features, and allows the alias to differ only there: where 8.0.0 failed, or chose a cache manager by a priority only its object has, and none is preferred by its definition, the result may be what grailsCacheManager gives, and where it is created from the cache-aware bean, a failed startup. Where Spring takes grailsCacheManager by name it asks no factory or resolvable dependency and fetches no other candidate, which the features now expect. CacheAutoConfigurationSpec pins the three startup failures and that marking the cache manager primary starts.
The code the cache annotations generate read the cache manager once a call into a local, its locals took names unlike the method's parameters, which that local had made necessary, and it read the cache manager and the key generator through their getters. None of that is needed for the reported failure or the missing cache, so the transformations are back to what they were at 7b358da, with the null check for a missing cache. The getters fix a pre-existing bug, a parameter named grailsCacheManager or customCacheKeyGenerator hiding the property, which goes in a pull request of its own. MissingCacheReporter keeps its weak identity keys and the fix for first calls that come at once. MissingCacheSpec drops the features for one read a call and for the parameter names, and checks two equal cache managers on the reporter itself.
A subclass of a cache-aware class inherits a method its superclass marks with @Inject or @value, which Spring's autowiring runs after the class's fields, so it sees the cache manager, as in 8.0.0, also where the alias gives grailsCacheManager. A method marked with both @resource and @Autowired belongs to the post-processor for @resource, which runs before autowiring, so it sees no cache manager, as in 8.0.0 too. The matrix spec now covers the three against 8.0.0, in two prototype instances each.
…e-manager-8.0.x 8.0 (fix): Start with another CacheManager next to the Grails cache plugin's
…ger matrix spec Spring Framework 7.1 replaces ClassNameGenerator with NameGenerator, which the other AOT specs on this branch already use. GrailsCacheManagerAliasMatrixSpec, merged up from 8.0.x with apache#16980, follows them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merges
8.1.xinto9.0.x, which brings #16980 (resolve the cache manager beside anotherCacheManager, and run a method uncached where its cache does not exist), #17087 (release the OSIV sessions past a failure inpreHandle, Hibernate 5 and 7) and, through 7.x, #17086 (its 7.0.x counterpart) to this line.One conflict, in the
grails-upgradeskill, resolved to 9.0.x's side: on this branch the skill upgrades from Grails 8 to Grails 9 and has parts for Grails 9 releases only, so the 8.0 section stays in the 8.x skill.A second commit follows the merge: Spring Framework 7.1 replaces
ClassNameGeneratorwithNameGenerator, soGrailsCacheManagerAliasMatrixSpecfrom #16980 builds its AOT generation context withNameGenerator, as the other AOT specs on this branch do (80a84cc did the same for two other specs). With it, grails-cache's tests pass on this branch (132 tests), and the Hibernate 5 and 7 plugins compile.This branch is built on #17155 (
8.0.xinto8.1.x), so merge that one first.