vendredi 27 février 2015

Unable to wire using ActiveProfile annotation

First time using Profiles and need help. I have an abstract base class (DecisionManagementRuleExecutor) that gets its dependency (RuleHandler) wired through annotation.



@Component
public class RuleHandler {......

public abstract class DecisionManagementRuleExecutor<M extends PersistentEntity,T extends Response> implements RuleExecutor<M,T>{

@Autowired
RuleHandler ruleHandler;


When I run with 'itest' profile, I want 'ITestRuleHandler' a child of 'RuleHandler' to be wired. Where 'ItestRuleHandler' is



@Component
@ActiveProfiles(value = "itest")
public class ITestRuleHandler extends RuleHandler {


I see that in the logs that active profile is 'itest'



System.getProperty("spring.profiles.active")


I am pasting the log for the wiring



Processing injected element of bean 'vendorServiceRuleExecutor': AutowiredFieldElement for c.a.p.d.RuleHandler c.a.p.d.s.DecisionManagementRuleExecutor.ruleHandler
Returning cached instance of singleton bean 'ITestRuleHandler'
Creating shared instance of singleton bean 'ruleHandler'
Creating instance of bean 'ruleHandler'
Eagerly caching bean 'ruleHandler' to allow for resolving potential circular references
Finished creating instance of bean 'ruleHandler'
Autowiring by type from bean name 'vendorServiceRuleExecutor' to bean named 'ruleHandler'
Finished creating instance of bean 'vendorServiceRuleExecutor'

Aucun commentaire:

Enregistrer un commentaire