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

Add listener constructor #956

Closed
wants to merge 4 commits into from

Conversation

Sineaggi
Copy link

This allows for code such as

Server server = new Server(8080);
ServletContextHandler contextHandler = new  ServletContextHandler(ServletContextHandler.SESSIONS);
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.register(AppConfig.class);
contextHandler.addEventListener(new ResteasyBootstrap());
contextHandler.addEventListener(new SpringContextLoaderListener(rootContext));
contextHandler.addServlet(HttpServletDispatcher.class, "/*");
server.setHandler(contextHandler);
server.start();
server.join();

to be used inside of a servlet 3.0 container such as the Jetty server, without requiring web.xml and applicationContext.xml files.

@Sineaggi
Copy link
Author

Sineaggi commented Sep 27, 2016

Whoops, I just checked the pom file. The resteasy-spring project uses Spring 3.0.6.RELEASE as it's spring version, whereas I'm testing with 4.3.3. Is there a plan to bump spring version numbers?

@asoldano
Copy link
Member

@Sineaggi we'll eventually upgrade to a more recent spring version in the future, not now though. What is the minimum requirement for your change here, Spring 4.3.0?

@Sineaggi
Copy link
Author

Sineaggi commented Sep 28, 2016

@asoldano I've just tested, Spring 4.0.0 Spring 3.1.0 is the minimum requirement. I can try to investigate if we could add a method that sets the WebApplicationContext, while not requiring a constructor-based invocation. It would appear that AnnotationConfigWebApplicationContext is also available in Spring 3.x so it may be possible. If not, applicationContext.xml is a file alternative for the time being.

Edit: Just tested version numbers again, I was able to drop requirements as low as Spring 3.1.0.

@Sineaggi
Copy link
Author

Not sure what the failing test is about.

Failed tests: 
  AsynchBasicTest.testAsynchTen:273 expected:<200> but was:<202>
Tests run: 1243, Failures: 1, Errors: 0, Skipped: 1

@Sineaggi
Copy link
Author

Fixed, seems like it was a fluke.

@asoldano
Copy link
Member

OK, thanks. Currently reasoning on the implications of spring upgrade, to decide when to merge this PR.

@asoldano asoldano closed this in f0fb482 Sep 30, 2016
@asoldano
Copy link
Member

OK, I've squashed your commits in a single one and merged upstream after having moved to Spring 3.1.0.RELEASE. Thanks!

@Sineaggi Sineaggi deleted the add-listener-constructor branch September 30, 2016 14:38
@Sineaggi
Copy link
Author

Thank you!

@UltimaPhoenix
Copy link
Contributor

UltimaPhoenix commented Feb 21, 2017

I hope that this time the pull request will not be reverted anymore, ref. my previous accepted and then reverted pull request #623 (2 Feb 2015)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants