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

Port already in use due to local quoters #52

Open
marcusfey opened this issue Dec 28, 2022 · 3 comments
Open

Port already in use due to local quoters #52

marcusfey opened this issue Dec 28, 2022 · 3 comments
Labels
good first issue A good issue for beginners help wanted An issue the community can address

Comments

@marcusfey
Copy link

I tried to run this example with quoters running locally as well - as suggested in "Fetching a REST Resource". The (consumer) application failed to start due to Web server failed to start. Port 8080 was already in use.

IMHO there is no reason why this consumer application should fire up a web server.

Thus the solution for me was to change the main method to

new SpringApplicationBuilder(GsConsumingRestApplication.class)
	.web(WebApplicationType.NONE) // .REACTIVE, .SERVLET
	.run(args);

Would it be okay to include this in the repo?

@bwalshe
Copy link

bwalshe commented Mar 6, 2023

Alternatively, you could change the spring-boot-starter-web dependency to spring-boot-starter-json. This includes all the dependencies needed for the consuming app, but doesn't add a web server to the classpath.

@Buzzardo
Copy link
Contributor

Buzzardo commented Oct 9, 2023

I tried to run this example with quoters running locally as well - as suggested in "Fetching a REST Resource". The (consumer) application failed to start due to Web server failed to start. Port 8080 was already in use.

IMHO there is no reason why this consumer application should fire up a web server.

Thus the solution for me was to change the main method to

new SpringApplicationBuilder(GsConsumingRestApplication.class)
	.web(WebApplicationType.NONE) // .REACTIVE, .SERVLET
	.run(args);

Would it be okay to include this in the repo?

I would welcome that change as a PR. You are correct that there's no reason to fire up a web server for this application, and the reactive approach is a good way to avoid that unnecessary overhead.

I'm adding the good first issue label, in case someone wants to use it as their first contribution to Spring.

@Buzzardo Buzzardo added the good first issue A good issue for beginners label Oct 9, 2023
@Buzzardo
Copy link
Contributor

Buzzardo commented Oct 9, 2023

Alternatively, you could change the spring-boot-starter-web dependency to spring-boot-starter-json. This includes all the dependencies needed for the consuming app, but doesn't add a web server to the classpath.

You are right. However, the solution proposed in the initial comment is better, because it removes the unnecessary overhead of starting a web server.

@Buzzardo Buzzardo added the help wanted An issue the community can address label Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue A good issue for beginners help wanted An issue the community can address
Projects
None yet
Development

No branches or pull requests

3 participants