1

I am currently defining my Base specification as below:

@Configuration
@ActiveProfiles(profiles = "test")
@ContextConfiguration(locations = "classpath:test-config-context.xml" )
class SpringSharedSpecification extends Specification 

This also end up in processing my parent application-context.xml

I am using active profile option to not to load the main beans and execute with test-config I used below to skip application-context beans but doesn't feel it is the best way to do it. Can anyone suggest better way of skipping application-context.xml?

<beans profile="!test"> 

Thanks in advance for your answer.

1 Answer 1

1

You can use annotation on your bean class:

@Component
@Profile("!test")
class MyProductionBean {
}
Sign up to request clarification or add additional context in comments.

1 Comment

Glad for you. Could you please mark this answer as 'accepted' (by pressing green mark sign)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.