Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8044149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:08:07+00:00 2026-06-05T05:08:07+00:00

Classes are compile time weaved. I read in the documentation that weaved classes would

  • 0

Classes are compile time weaved. I read in the documentation that weaved classes would warn on classes constructed outside the container context but not outright error, yet I get the following test error in the maven build:

testExecuteCommand(SportTimeExecutionCommandTest): Error creating bean with name 'SportTimeExecutionCommand': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'timeStrategyAnalyzer' is defined

This is despite me running the test with the Mockito junit class runner.

@RunWith(MockitoJUnitRunner.class)
public class SportTimeExecutionCommandTest {

    private static final Integer SPORT_ID = 1; 


    @Mock
    private IdTimeRequestAdjuster idTimeRequestAdjuster ; 
    @Mock
    private StrategyAnalyzer<List<TimeStep>> strategyAnalyzer;
    @Mock
    private SportStepExecutor stepExecutor ; 
    @Mock
    private TimeRequestStrategy strategy ; 
    @Mock 
    private TimeStep step; 

    @Mock
    private Future<List<EventData>> future; 

    private SportTimeExecutionCommand command; 


    private List<TimeStep> steps = new ArrayList<TimeStep>(); 

    @Before
    public void setUp() throws Exception {

        command = new SportTimeExecutionCommand(SPORT_ID); 
        command.setIdTimeRequestAdjuster(idTimeRequestAdjuster);
        command.setStepExecutor(stepExecutor); 
        command.setStrategyAnalyzer(strategyAnalyzer); 
        when(idTimeRequestAdjuster.getCurrentValue(SPORT_ID)).thenReturn(strategy);
        when(strategyAnalyzer.calculateSteps(strategy)).thenReturn(steps); 
        steps.add(step); 
        when(stepExecutor.executeStep(SPORT_ID, step)).thenReturn(future); 
        when(future.get()).thenReturn(new ArrayList<EventData>()); 
    }

    @Test
    public void testExecuteCommand() throws InterruptedException, ExecutionException {
        command.executeCommand(); 
        verify(idTimeRequestAdjuster).getCurrentValue(SPORT_ID);
        verify(strategyAnalyzer).calculateSteps(strategy); 
        verify(stepExecutor).executeStep(SPORT_ID,step); 

    }

}

Implementation class for reference :

@Configurable(autowire=Autowire.BY_TYPE)
public class SportTimeExecutionCommand implements AdjustingCommand<List<EventData>,Integer>{

    private final static Logger logger = Logger.getLogger(SportTimeExecutionCommand.class.getName());

    @Autowired
    private IdTimeRequestAdjuster idTimeRequestAdjuster ; 

    @Resource(name = "timeStrategyAnalyzer")
    private StrategyAnalyzer<List<TimeStep>> strategyAnalyzer;

    @Autowired
    private SportStepExecutor stepExecutor ; 

    private final Integer sportId ; 

    public SportTimeExecutionCommand(Integer sportId)
    {
        this.sportId = sportId ;
    }

    @Override
    public List<EventData> executeCommand() throws InterruptedException, ExecutionException {
        List<EventData> eventData = new ArrayList<EventData>();
        List<TimeStep> timeSteps = strategyAnalyzer.calculateSteps(idTimeRequestAdjuster.getCurrentValue(sportId));
        List<Future<List<EventData>>> futureResults = new ArrayList<Future<List<EventData>>>();

        for (TimeStep timeStep : timeSteps) {
            futureResults.add(stepExecutor.executeStep(sportId, timeStep));
        }

        for (Future<List<EventData>> futureEventData : futureResults) {
            eventData.addAll(futureEventData.get());
        }


        return eventData;
    }

    @Override
    public Integer getCriteria() {
        return sportId; 
    }

    @Override
    public void adjust() {
        logger.warning("adjusting sportId "+sportId+" value is now : "+idTimeRequestAdjuster.getCurrentValue(sportId).getRequests()); 
        idTimeRequestAdjuster.adjustUp(sportId);
    }

    public void setIdTimeRequestAdjuster(IdTimeRequestAdjuster idTimeRequestAdjuster) {
        this.idTimeRequestAdjuster = idTimeRequestAdjuster;
    }

    public void setStrategyAnalyzer(StrategyAnalyzer<List<TimeStep>> strategyAnalyzer) {
        this.strategyAnalyzer = strategyAnalyzer;
    }

    public void setStepExecutor(SportStepExecutor stepExecutor) {
        this.stepExecutor = stepExecutor;
    }

}

Can someone see the problem ?

EDIT: I suspect that it processes the resources first which is why the error happens here. If I switch the annotation to autowired then it will break on the first autowired bean instead.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:08:10+00:00Added an answer on June 5, 2026 at 5:08 am

    My solution was to run a seperate maven build profile which compiled without aspects, then in the integration phase compile with aspects.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting an anonymous class at compile-time that I'm not expecting. Relevant code follows,
I am getting this weird RunTime error. The classes compile easy on eclipse but
In case of compilation errors, ant javac task will not compile all classes which
I have many structs (classes) and standalone functions that I like to compile separately
Is it possible to enforce a compile-time contract on derived classes requiring implementation of
I'm working on a Eclipse plugin that needs classes which are not known at
Sometimes we have several classes that have some methods with the same signature, but
I have a template function and wish to ensure at compile time that it
I am trying to convert my load-time-woven aspectj to compile-time-woven. So I removed <context:load-time-weaver/>
Why are protected members allowed in final classes? Shouldn't this be a compile-time error?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.