Skip to content

Spring-instrument and auto injection in new object [SPR-9659] #14293

@spring-projects-issues

Description

@spring-projects-issues

Vladimir opened SPR-9659 and commented

I have spring 3.1 application. And I Have spring-instrument java agent, I have configurable class:

@Configurable
public class WeavingClass {

    @Resource
    @Getter
    private ApplicationContext ac;

    public WeavingClass()
    {

    }

}
{/code}
And I Have unit test:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes={WebBackendContextConfig.class})
@Slf4j
public class TestWeavingInjection extends TestCase {

@Test
public void isInjectedTest()
{
    WeavingClass wc = new WeavingClass();
    assertNotNull(wc.getAc());
}

}
{/code}
And I Have:

@Configuration
@PropertySource(value={"classpath:META-INF/conf/liteicms-backend.properties"})
@ComponentScan(value={"ru.icb.liteicms.backend.service", "ru.icb.liteicms.domain", "ru.icb.liteicms.backend.domain.contentpage.wrappers"})
@EnableSpringConfigured
@EnableLoadTimeWeaving
@EnableAspectJAutoProxy
public class WebBackendContextConfig {

}
{/code}
I run my test with -javaagent:org.springframework.instrument-3.1.1.RELEASE.jar My test working without errors.

But if I add this:

private HashMap<Class<?>, Class<?>> builderMap = new HashMap<Class<?>, Class<?>>()
{
private static final long serialVersionUID = 1L;
{
put(String.class, WeavingClass.class);
}
};
{/code}
My test has broken.


Affects: 3.1.1

Reference URL: http://stackoverflow.com/questions/11755152/spring-instrument-and-auto-injection-in-new-object

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently apply

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions