component-scan Questions
4
I and my friend were discussed about @ComponentScan and @Import. Which one is better?
We have 2 different ideas.
@ComponentScan: Easy to use, import all beans from the component
scan.
@Import: Yo...
Curry asked 11/4, 2020 at 7:58
2
Solved
@ComponentScan( //CS1
basePackages = {"com.package.A", "com.package.B"},
excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,
value = {com.Package.A.SomeClass.class
})
)
@...
Arleta asked 1/11, 2016 at 12:11
4
Solved
I'm struggling to autowire beans from my custom library, imported with gradle.
after reading couple of similar topics I am still unable to find solution.
I have a Spring Boot project that depends o...
Martijn asked 23/1, 2017 at 21:21
6
Solved
I am having trouble auto wiring a feign client from another project. It appears that the implementation of the feign client is not being generated and injected.
This is the error I am getting.
or...
Victoria asked 14/5, 2015 at 15:27
2
Solved
I have a project with a Spring container. Let's say this project is called my-common-library and uses the namespace my.common. It scans all components in this namespace, as specified in common-cont...
Precedence asked 18/8, 2014 at 16:2
1
Solved
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 ...
Inez asked 3/9, 2020 at 18:6
2
Solved
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(...
Warring asked 23/5, 2020 at 11:44
8
Solved
How can I add multiple packages in spring-servlet.xml file in context:component-scan element?
I have tried
<context:component-scan base-package="z.y.z.service" base-package="x.y.z.controller" ...
Reggy asked 11/3, 2011 at 5:50
2
I am trying to disable real Mongo connection and replace it with Fongo mock in tests.
Here is my test class:
@SpringBootTest
@RunWith(SpringRunner.class)
public class ControllerTest {
@Autow...
Ephraim asked 2/4, 2018 at 14:35
4
Solved
I'm maintaining a project with two set of main packages, the project is using Spring and Spring MVC, one of these packages contains several controllers and is scanned using XML configuration (<c...
Nuncia asked 9/1, 2014 at 13:52
3
Solved
I have a repository in different package than the configuration class , so I annotated it as the following with @Repostiory:
package test;
@Repository
public interface UserTest extends JpaReposit...
Bedroom asked 6/11, 2018 at 12:53
2
Solved
I am using spring component scan to auto detect beans as:
@ComponentScan({"com.org.x, com.org.y"})
The issue is I want all classes in com.org.x to be scanned but I want a single class, com...
Alita asked 10/6, 2016 at 22:7
2
Solved
Spring boot provides @ComponentScan to find packages to be scanned.
I am building a library which has @RestControllers inside with package com.mylib.controller. There are other classes as well wit...
Milson asked 15/2, 2018 at 13:45
1
@ComponentScan will give you a list of all the classes with the @Component annotation in a package (or @Service/@Repository). To do this I imagine they use reflection to enumerate all the classes i...
Michael asked 7/6, 2017 at 4:45
3
Solved
I would like to implement something similar to Spring Data.
Developer can define some interfaces, add a custom annotation to the interfaces to mark them, (my code will create Proxy instances for t...
Detoxify asked 21/4, 2017 at 9:6
3
Solved
As per Spring Doc-
Configures component scanning directives for use with @Configuration classes. Provides support parallel with Spring XML's <context:component-scan> element.
In my sprin...
Ratable asked 8/2, 2017 at 10:51
1
Solved
I have encountered a strange problem. I am under the impression that component scan scans the sub packages recursively if a top level package is specified for scanning.
My repositories and entitie...
Toothlike asked 20/6, 2016 at 6:22
2
Solved
What is the difference between getServletConfigClasses() vs getRootConfigClasses() when extending AbstractAnnotationConfigDispatcherServletInitializer.
I've been reading a lot sources since this mo...
Iseult asked 7/2, 2016 at 20:32
2
Solved
I'm having some difficulty preventing Spring Boot from auto configuring some classes (in this example: SolrAutoConfiguration). To illustrate I've setup a much reduced example:
https://github.com/t...
Sela asked 27/7, 2015 at 16:14
1
Solved
Spring's @ComponentScan offers a type-safe basePackageClasses attribute - seems a good thing to use especially as it isn't uncommon for packages to be renamed on the project I'm working on. T...
Relucent asked 2/12, 2014 at 16:43
1
I have an integration test class annotated as follows
@WebAppConfiguration
@ContextConfiguration(classes = {AppConfiguration.class})
@RunWith(SpringJUnit4ClassRunner.class)
public class CacheCons...
Denature asked 31/3, 2014 at 22:4
1
© 2022 - 2024 — McMap. All rights reserved.