-1

I've been trying to get some data from classes instantiated by Spring boot, like controllers and services, to display them in local program, the same on that is supposed to start the whole thing. However, I can't find a way to get a reference of said classes. I want my program to be able to start server not upon starting, but with a button, as well as shutting it down without closing in the same way. Is there a way to do so?

Edit: The program needs to build & run spring application on click of corresponding button, also it has to be able to shut it down entirely on click. While it's built & running, the controller class (or any other annotated class used by Spring) needs to be accessed by the said program to process and display locally some data it receives.

2
  • Your question is too vague to begin answering it. We need more information, details or at least clarity as that is totally lost. Commented Apr 7 at 18:17
  • Can you specify in more detail what you are trying to approach? Is it just disabling functionallity/prevent processing request for any reason or is it for ressource optimization? Because in SpringBoot you cannot dynamically start or stop controllers / services but toggle them using flags or AOP checks. Commented Apr 7 at 19:41

1 Answer 1

0

I fixed it. The issue was the fact that Spring scans for components only within the folder the starting class is located at. After moving it to the main folder everything started working as expected, with Spring's getBean giving me instances of classes I needed.

Sign up to request clarification or add additional context in comments.

Comments

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.