Deniss M. Deniss M. - 3 months ago 24
Java Question

spring boot: only for web application development?

I want to get myself more familiar with Spring Data & Spring Boot. I have looked at examples and couldn't find one that is not used by running it on a server like tomcat etc.

Is it possible to develop a simple client application that just talks to the db and runs on an OS by using spring data or spring boot?

Answer

I get a sense that your question is rather:

Can spring boot be run without a web container?

Simply start your spring boot app in a non-web environment:

new SpringApplicationBuilder() //
    .sources(SpringBootApp.class)//
    .web(false)
    .run(args); 

Also, you obviously should not add the spring-boot-starter-web dependency.

Without web(false), spring boot launches a web container if it finds one in the classpath. web(false) ensure that it does happens. Tomcat could be included by another dependency without your knowledge, so better to disable the web environment if that is your goal.