Skip to content

Callback interfaces such as LoadTimeWeaverAware should allow for local overriding [SPR-13892] #18466

Closed

Description

@spring-projects-issues

Andrei Ivanov opened SPR-13892 and commented

Trying to inject a custom LoadTimeWeaver into a LoadTimeWeaverAware fails, as it initially gets injected but then the LoadTimeWeaverAwareProcessor comes along and injects the default loadTimeWeaver.

<context:load-time-weaver />

<bean class="org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
	<property name="defaultPersistenceUnitName" value="compositePU" />
	<property name="packagesToScan">
		<list>
			<value>com.test.module1.entity</value>
			<value>com.test.module2.entity</value>
		</list>
	</property>
	<property name="properties">
		<props>
			<prop key="eclipselink.composite-unit">true</prop>
		</props>
	</property>
	<property name="loadTimeWeaver">
		<bean class="CustomLoadTimeWeaver" />
	</property>
</bean>

Affects: 4.2.4

Issue Links:

0 votes, 5 watchers

Activity

  1. spring-projects-issues commented on Apr 12, 2016

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    This is so far by design: You can either populate such a setter manually or set up a context-wide reference, not both at the same time. If there is a context-wide LoadTimeWeaver to share, it actually takes precedence. This is the same for other *Aware interfaces.

    In your case, you'd have to set up your "loadTimeWeaver" bean as your custom class manually, instead of using <context:load-time-weaver>.

  2. spring-projects-issues commented on Apr 12, 2016

    @spring-projects-issues
    CollaboratorAuthor

    Andrei Ivanov commented

    Hm, I think it's a bit unfortunate.
    I would consider the context-wide reference to be the default when there isn't a specific reference specified.
    That would also work with the convention over configuration principle as well.

    If I have a lot of beans using the default weaver and just one that needs a special weaver it means I have to manually set them all instead of just that one bean (in this case, a specific weaver for JPA) :(
    And I don't even know what other infrastructure beans I might have that require the default weaver.

  3. spring-projects-issues commented on Apr 13, 2016

    @spring-projects-issues
    CollaboratorAuthor

    Andrei Ivanov commented

    Any chance to turn this into a more generic improvement request regarding local overriding of injected properties by post-processors? :)

  4. added
    status: waiting-for-triage
    type: enhancement
    and removed
    type: enhancement
    on Jan 11, 2019
  5. added
    status: bulk-closed
    and removed
    status: waiting-for-triage
    on Jan 11, 2019
  6. spring-projects-issues commented on Jan 12, 2019

    @spring-projects-issues
    CollaboratorAuthor

    Bulk closing outdated, unresolved issues. Please, reopen if still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: bulk-closed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions