Psycho Punch
Psycho Punch

Reputation: 6892

Which Spring module should I use for a command line Spring Boot application that uses RestTemplate?

I'm working on a simple command line application using Spring Boot. I need it to interface with some REST API using Spring's RestTemplate. Should I reference as a dependency spring-boot-starter-web or spring-web? Will the presence of any of those in the classpath alter the behavior of the Spring Boot application that's supposed to be a straightforward command line application?

Upvotes: 1

Views: 1639

Answers (1)

zapl
zapl

Reputation: 63955

I would stick with what https://spring.io/guides/gs/consuming-rest/ does.

When you don't want to create a webserver, don't use -starter-web. Use the plain -starter to have "naked" boot application and add spring-web to have access to RestTemplate.

Upvotes: 2

Related Questions