135 questions
0 votes
0 answers
44 views
bean defined in parent @configuration in multi module maven project is not created
I am dealing with a rather complicated spring boot project. There is a strange issue, that a bean defined in a parent @configuration file is seemingly not instantiated IF a descendant @Configuration ...
0 votes
1 answer
46 views
Does adding a module dependency enable component scanning?
I have a project which has 2 modules A and B. Module A depends on module B. (Maven compile and test dependency). Module A and module B have the same package structure and names i.e module A/src/main/...
0 votes
1 answer
95 views
Cannot apply library properties in Spring Boot application
I created an Java Spring library to audit and log execution times during the execution of my application. I deployed it on SonaType and load it as a dependency in a demo project. The properties of my ...
1 vote
1 answer
254 views
How to create a Spring Library and consumers can import all the beans automatically?
I have created my own library and it has some code like this package com.example.demo.service; @Slf4j @Service @RequiredArgsConstructor public final class MyCustomService { ... } package com.example....
1 vote
1 answer
107 views
Spring - component-scan error while trying to use annotations
I am learning Spring, and following an example on YouTube about Annotations. When I try to use component-scan in the spring.xml file, I get this error message: Context namespace element 'component-...
0 votes
1 answer
31 views
Why does a near-identical service not require @ComponentScan for accessing library beans?
We have created a new Spring Boot service. As part of it we would like to improve our general testing habits by utilizing test slices more effectively (and not loading in the whole context). We are ...
1 vote
0 answers
102 views
multi-module bean not found
I am developing a service by combining Kotlin, Spring Boot, multi-module, and hexagonal architecture. While implementing the login logic, I encountered the following error: *************************** ...
0 votes
1 answer
92 views
Does @SpringBootTest scan bean configuration test package if has same name?
Above is codes in main.kolitn.~~ package com.example.demo // in main folder @SpringBootApplication class DemoApplication fun main(args: Array<String>) { runApplication<DemoApplication&...
1 vote
0 answers
46 views
excludeFilters in ComponentScan stops the http_server_request actuator metrics
We have a spring based simple library where we added some new implementation in a new dedicated package. Sharing the main configuration from class that package @Configuration public class ...
1 vote
0 answers
146 views
Why does SpringBootTest ComponentScan finds a bean outside of the basePackages and tries to create it?
I have a @SpringBootTest that use a @Configuration class with @ComponentScan: @SpringBootTest(classes = BaseTest.Conf.class) public class SocGenTest extends BaseTest { And the configuration class: ...
0 votes
0 answers
94 views
@SpringBootApplication not detecting another @Configuration component in the same package
This is my project package structure. org.myApp MainApplication.java org.myApp.controller org.myApp.repositories org.myApp.utils I have a @SpringBootApplication placed in ...
0 votes
1 answer
3k views
Redundant declaration: @SpringBootApplication already applies given @ComponentScan
I created a spring boot application(3.0.1). Then I connected the Postgres database and executed it. The application is up on server 8080 smoothly. then I added below-mentioned annotations. @...
0 votes
1 answer
602 views
Spring Boot: scanning components into an injectable list or set
Spring Boot here. I have dozens and dozens of classes that are all subclass/implementations of the same interface: public interface AnimalService { void eat(); // etc. } @Component public ...
1 vote
1 answer
952 views
Spring Boot: ComponentScan vs Declared Bean in an Autoconfigured Jar
Suppose I have a jar with a Spring Component called MyComponent. This jar is a Spring Boot "autoconfigured" jar, meaning that it has a Configuration class (annotated with @Configuration), ...
0 votes
0 answers
471 views
The Actual Different: Spring boot @ComponentScan vs @Import when involving ConditionalOnClass
Context I know there are a lot of posts regarding the comparison between these two. All of them just focus on @Import works on single Config file while @ComponenentScan will scan all config, bean, ...