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,
- Java equals method - Tutorial
- Unbound classpath container: JRE System Library [JavaSE-1.7]
- Spring Boot: @RequestBody not applicable to method
- Java 8: Steam map with Code Examples
- Java Program: Random Number Generator
- Java java.time.Clock class code examples [Java Date Time API]
- Fix: type argument is not within bounds of type-variable T
- [Fix] java.net.MalformedURLException: unknown protocol
- Java 7 addSuppression() and getSuppression() Exception Handling
- Convert Java Array to ArrayList Code Example
- How to Word-Warp Console logs in IntelliJ
- Ways Compare Dates in Java Programming with Examples
- Remove Trailing zeros BigDecimal Java
- CRUD operations in Spring Boot + JDBC
- [Java Threads] Should we extend Thread Class or implement Runnable interface
- Json Serialization and Deserialization using Java Jackson
- Create simple struts2 project using maven commands
- How to install Java OpenJDK 11 on Alpine Linux
- Unsupported major.minor version 52.0 in java
- Error: Can not find the tag library descriptor for
- Java: Convert String to Binary
- How to run Java Unit Test cases with Apache Maven?
- Java: Testing Private Methods in JUnit using reflection API Example
- Java JDBC Connection with MySQL Driver in VS Code + Troubleshooting
- Java Join Strings with Comma Separator
More Posts:
- How to adjust MacBook Desktop icons size - MacOS
- How to rename a Pandas DataFrame Column Names - Python
- Fix SharePoint PowerShell error - The term Get-SPweb is not recognized as the name of a cmdlet function script file or operable program - SharePoint
- [macOS] How to search or view previous terminal command history - MacOS
- How to format LocalDate in Java using DateTimeFormatter - Java
- Eclipse Error : The Eclipse executable launcher was unable to locate its companion shared library. - Eclipse
- Json Serialization and Deserialization using Java Jackson - Java
- Running Android Lint has encountered a problem NullPointerException Error - Android