Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring boot: only for web application development? [closed]

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?

like image 240
Deniss M. Avatar asked Mar 11 '23 09:03

Deniss M.


1 Answers

I undertand, from you're post, The following question:

How to run spring boot 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.

By default, spring boot launches a web container if it finds one in the classpath. Using web(false) ensures that it does not happen. Tomcat could be included by another dependency without your knowledge, so it's better to disable the web environment if that is your goal.

like image 170
alexbt Avatar answered Apr 27 '23 14:04

alexbt