Error creating bean with name 'securityConfig':
Unsatisfied dependency expressed through field 'dataConfig';
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type 'org.code2care.DataConfig' available:
expected at least 1 bean which qualifies as autowire candidate.
Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
You get this error due to an issue with Spring Framework related to dependency injection, there seems to be a problem with autowiring a bean of type org.code2care.DataConfig in your SecurityConfig class.
Make sure the below classes are defined correctly.
@Configuration
public class DataConfig {
@Bean
public DataConfig dataConfig() {
return new DataConfig();
}
}
@SpringBootApplication
@ComponentScan(basePackages = "org.code2care")
public class DataApplication {
public static void main(String[] args) {
SpringApplication.run(DataApplication.class, args);
}
}
Also make sure @Autowired annotation as been added on DataConfig instance.
@Autowired
private DataConfig dataConfig;
And finally, make sure @DependsOn is added on SecurityConfig.
@Configuration
@DependsOn("dataConfig")
public class SecurityConfig {
...
...
Facing issues? Have Questions? Post them here! I am happy to answer!
More Posts related to Java,
- Deep Dive into Java 8 Predicate Interface
- Read and Parse XML file using Java DOM Parser [Java Tutorial]
- Java 8 Predicate Functional Interface isEqual() Method Example
- Convert Multidimensional Array toString In Java
- How to read int value using Scanner Class Java
- Spring Boot AI + LLM + Java Code Example
- Write to a File using Java Stream API
- Implementing Bubble Sort Algorithm using Java Program
- How to Fix XmlBeanDefinitionStoreException in Java SpringBoot ApplicationConfig.xml
- YAML Parser using Java Jackson Library Example
- [Fix] java: integer number too large compilation error
- Convert JSON String to Java GSON Object Example
- Read a file using Java 8 Stream
- Java Spring Boot 3 Web Hello World with Gradle in IntelliJ
- Ways Compare Dates in Java Programming with Examples
- Pretty Print JSON String in Java Console Output
- Java JDBC with Join Queries Example
- How to Check For Updates on Windows 11 (Step-by-Step)
- [Fix] java.net.MalformedURLException: unknown protocol
- How to display date and time in GMT Timezone in Java
- Error: LinkageError occurred while loading main class UnsupportedClassVersionError [Eclipse Java]
- How to convert a String to Java 8 Stream of Char?
- RabbitMQ Queue Listener Java Spring Boot Code Example
- 5+ Fibonacci number Series Java Program Examples [ 0 1 1 2 3 ..]
- Handling NullPointerException with Java Predicate
More Posts:
- Simple Crossword Puzzle example using Pure HTML, CSS and JavaScript - Html
- BeanDefinitionStoreException IOException parsing XML document from class path resource [spring.xml] - Java
- INSTALL_FAILED_INSUFFICIENT_STORAGE Error Android Emulator - Android
- Fix error The tool was unable to install the Web Server (IIS) Role during SharePoint 2019 Setup - SharePoint
- Perform Basic Authentication using cURL with Examples - cURL
- How to save IntelliJ IDE Console logs to external log file - Android-Studio
- [Fix] ValueError: substring not found in Python - Python
- [Docker M1/M2 Mac] qemu-x86_64: Could not open /lib64/ld-linux-x86-64.so.2: No such file or directory AWS CLI - Docker