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 7708685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:40:30+00:00 2026-06-01T00:40:30+00:00

This is for some high level Web/Rest tests of my whole system that are

  • 0

This is for some high level Web/Rest tests of my whole system that are being powered by Jetty/Spring.

What I am trying to do is to have a completely self contained test that,

  • Starts Jetty which starts the Application
  • Application starts Spring
  • Test uses Webdriver / RestAssured to hit application and test behavior
  • Test checks DB for changed data

What I am trying to do is have the whole thing running in a single JVM, i.e. I’m starting a org.eclipse.jetty.server.Server.
This is because its easy, and avoids the test having outside dependencies (like starting Jetty)

This is all cool, but I hate that I have to check the DB manually … I want to use my DAO (or maybe service layer) classes so I’m not re-writing DB code.

Since my DAO’s have already been started by Spring in the Jetty instance in the same JVM as the test case, I want to grab that ApplicationContext and then pull my DAO beans out.

I’m a bit stuck getting the ApplicationContext since the test isn’t a “Spring” test per say.

People got any ideas on how to do this?

  • 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-01T00:40:32+00:00Added an answer on June 1, 2026 at 12:40 am

    I think it is not possible to access the spring context in jetty if it is start normally, may it could work if you use some embedded server.

    But I think there are much simpler solutions:

    • use a second (different) spring context for the tests, this can be smaller than the “normal” one, because you will not need all the services and controllers, or
    • add some json or webservice query interface in your Server, that simply returns the requested result from the database. Then you can access the database from your tests via that interface in the server. — I think you only need two or three different querys per entity, so it should be not so much work, (but I would prefer the other solution).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a high-level question about web frameworks, that as a desktop app developer,
First high-level: I have a web page that will be showing correspondance between a
High level I have two tables that need to have some of the data
Hi I have been playing around with MDX and need some very high-level getting-started
I'm looking for a high level answer, but here are some specifics in case
High level: I am trying to build a console app (e.g. ConsoleApp.exe) which can
I'm looking for some high-level help with determining the best type of Visual Studio
A simple scenario. User logs in through the form baked by some high level
I am working on a Java web app with unit tests that deploy the
This is a high-level question and I am sure there is no universally correct

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.