Questions tagged [spring-autoconfiguration]

99 questions
28
votes
2 answers

Spring Boot 2.0.0 , DataSourceBuilder not found in autoconfigure jar

We are upgrading our existing Spring Boot (1.5) application to 2.0.0. We connect with multiple databases and use the org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder class. I added the dependency: compile group:…
16
votes
1 answer

What does server.error.include-binding-errors=on-param in Spring do?

What does the following setting in application.properties in a Spring application do? server.error.include-binding-errors=on-param I can't find it in the documentation. The always and never values are pretty self-explanatory, but I don't understand…
Lii
  • 11,553
  • 8
  • 64
  • 88
7
votes
1 answer

Spring Boot Custom Bean Loader

I am using JDBI in tandem with Spring Boot. I followed this guide which results in having to create a class: JdbiConfig in which, for every dao wanted in the application context, you must add: @Bean public SomeDao someDao(Jdbi jdbi) { return…
JDrost1818
  • 1,116
  • 1
  • 6
  • 23
5
votes
1 answer

Java Records are not working with ConfigurationProperties annotation

I'm using @ConfigurationProperties annotation to auto-config my properties. Before my config class was working fine, but I tried to achieve the same thing with records and just fails. I was following this SO answer, but in my case it didn't work:…
MrNobody
  • 535
  • 8
  • 24
5
votes
2 answers

Spring custom @Enable annotation meta-annotated with @ComponentScan

I'm trying to write my own @Enable annotation for Spring framework, which should be used as follows: package com.example.package.app; @SpringBootApplication @com.example.annotations.EnableCustom("com.example.package.custom") public class…
knittl
  • 246,190
  • 53
  • 318
  • 364
4
votes
0 answers

How to override SecurityFilterChain in Spring Boot context?

I am facing the issue which is not obvious to resolve just by reading the documentation. While migrating to Spring Boot v2.7.4 / Spring Security v5.7.3 I have refactored the configuration not to extend WebSecurityConfigurerAdapter and to look like…
dma_k
  • 10,431
  • 16
  • 76
  • 128
4
votes
1 answer

Why shall I not component-scan my auto-configuration?

In Spring Boot's documentation it is clearly stated that auto-configurations must be specified via the spring.factories file: Auto-configurations must be loaded that way only. Make sure that they are defined in a specific package space and that…
4
votes
1 answer

How to use @AutoConfigureOrder in a spring boot configuration class from a module

In my spring boot project I use a module, which provides a @Configuration class. The configuration ist imported via @Import(ConfigurationFromModule.class) in Application class. The configuration from the module needs to happen before a certain…
kai-dj
  • 315
  • 1
  • 18
3
votes
1 answer

Convert library to autoconfiguration/starter while in use

Our project has a library that defines several beans. Historically, it's a simple artifact, no autoconfig enabled and all other applications are using this artifact together with @ComponentScan. Now, I realize, that it should rather be an…
3
votes
0 answers

Does the use of @Configuration prevent auto-detection of @SpringBootConfiguration?

I've searched for the real meaning of using @TestConfiguration compared to @Configuration and I saw a statement in an official comment on @TestConfiguration. ...Unlike regular @Configuration classes the use of @TestConfiguration does not prevent…
3
votes
2 answers

Dependency prevents component scan in Spring Boot Application

I build a minimal example which shows the problem I faced the last days. In short, all dependencies of apereo CAS that I tried prevent my Spring Boot Application from auto configuration or from creating the components and beans. When no CAS…
Markus
  • 91
  • 11
3
votes
1 answer

Spring Boot : how auto configure works and @JsonTest

I've read some stuff about how auto-configuration works behind the scene (configuration classes with @Conditional, spring.factories inside /META-INF etc...) Now I'm trying to understand with an example : @JsonTest I can see this annotation is…
AntonBoarf
  • 1,239
  • 15
  • 31
3
votes
1 answer

Spring boot remove logback appender added in code(auto configuration)

I’d like to have spring auto configuration which adds LogstashTcpSocketAppender. What I have done: The LogstashTcpSocketAppender was added in to the LoggerContext from the LogstashAutoConfiguration.java @Configuration @ConditionalOnProperty(name =…
2
votes
1 answer

What determines spring boots bean registration order for auto configurations?

I have a multi subproject spring boot 3.0 application built by gradle. In modules A and B I have beans with the annotations @Bean @ConditionalOnBean(jakarta.jms.ConnectionFactory.class) declared. The actual app subproject containing the runnable…
SpaceTrucker
  • 13,377
  • 6
  • 60
  • 99
2
votes
2 answers

Why are these spring boot starter project jar's empty?

On looking at the jar files of few of the spring boot starter projects, I see there are no classes nor prop file in it. This may not be case for all of the project, but for the below jars I have noted this. So how does adding these projects really…
samshers
  • 1
  • 6
  • 37
  • 84
1
2 3 4 5 6 7