spring-boot application without a datasource

It is possible to run a spring boot application without datasource. You must disable the auto configuration for the datasource and may be for JPA also :

@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})

The exception you posted is something else, as written in the comments, you have something in the classpath that references the missing class of apache geronimo. So you must get rid of the code/jar that references geronimo or add geronimo to your dependencies.


A better way to fix this point will be to remove the dependencies from your POM/Gradle configuration file and Spring Boot will not try to auto configure the DataSource.


@Stefan +1 If you are using YAML file for configuration this is how it is

spring:
  profiles: dev
  autoconfigure:
    exclude:
    - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
    - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration

It worked perfectly fine for me.

Tags:

Spring Boot