I need to run spring-boot-maven-plugin start goal in our build process so that I can generate the Openapi.json with the springdoc-openapi-maven-plugin and generate typescript SDK with openapi-generator-maven-plugin.
My problem is that in my build environment I have no database connection.
I tried to circuvement this with using this configuration for the spring-boot-maven-plugin:
<argument>
--spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.session.SessionAutoConfiguration,
org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration,
org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration,
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,
org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,
org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration
</argument>
It kind of works, but all my service beans fail on startup, since the Repository beans can not be instiated.
If I mark them optional with @Autowired(required=false) the application starts and everything is fine, but I’m searching a solution where I dont need to configure all injection points this way.(This is a monolith application with 50+ repositories)