Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow @ContextConfiguration to be omitted [SPR-13955] #18528

Closed
spring-projects-issues opened this issue Feb 17, 2016 · 7 comments
Closed

Allow @ContextConfiguration to be omitted [SPR-13955] #18528

spring-projects-issues opened this issue Feb 17, 2016 · 7 comments
Assignees
Labels
in: test Issues in the test module type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Feb 17, 2016

Phil Webb opened SPR-13955 and commented

The @ContextConfiguration annotation is often not really needed if working with a single config. For example:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration 
public class MyTest {

	@Test
	public void sometest() throws Exception {

	}

	@Configuration
	static class Config {

		@Bean
		public String myBean() {
			return "Hello";
		}

	}

}

Issue Links:

Referenced from: commits 2244461

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Feb 17, 2016

Sam Brannen commented

Is this intended to supersede #18521, or is it in addition to #18521?

@spring-projects-issues
Copy link
Collaborator Author

Phil Webb commented

It would be in addition to I think. I'm still working though some ideas and I just wanted to jot it down.

@spring-projects-issues
Copy link
Collaborator Author

Phil Webb commented

Combined PR available for review at #983

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 8, 2016

Sam Brannen commented

Phil Webb,

I'm still wondering about this...

Is this intended to supersede #18521, or is it in addition to #18521?

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 8, 2016

Phil Webb commented

It's very subtle but I think they are different requests. See 636baf9b and d74f9e66 for the respective commits.

Having said that, I think my original use-case for #18521 has gone and I don't appear to be overriding the protected getDefaultContextConfigurationAttributes method in my current prototype. Originally I had used that to allow detection of the @Configuration class, I do do that by overriding processMergedContextConfiguration.

@spring-projects-issues
Copy link
Collaborator Author

Sam Brannen commented

Pushed to master with several changes:

2244461

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Mar 8, 2016

Sam Brannen commented

Thanks for the explanation, Phil.

Since you're no longer using that feature, I'll close #18521 for now.

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants