Class required a bean of type 'java.lang.String' that could not be found
Remove final
from sqsQueueMail
.
@Value("${aws.sqs.queue.mail}")
private String sqsQueueMail;
That should fix your issue.
Somehow, with @RequiredArgsConstructor
, the @Value
annotation for the variable is not resolved which made the application to look for a bean of type String
Parameter 0 of constructor in 'com.example..'. required a bean of type 'com.example...' that could not be found
Several ways to resolve this !
Annotate
your StudentService class with@Component
, during start up of application, Spring will identify this and create a bean in IOC container for use. ( Don't forget to use@ComponentScan(basePackages={com.example.demo.Stude...})
on top of yourDemoApplication
class )Create a Configuration class with
@Configuration
and define your own bean with@Bean
returning instance of StudentService
Eventually, use @Autowired
on top of your StudentService instance in Controller. Like below
<pre>public class Controller
{
@Autowired
StudentService service;
// so on
} </pre>
springboot: Parameter 0 of method addProduct required a bean of type 'java.lang.String' that could not be found
Remove the @Bean
annotation from the addProduct
method. That annotation is supposed to be used in configuration classes on methods, which create bean instances.
Related Topics
How to Print Out All the Elements of a List in Java
How to Post a Json Payload to a @Requestparam in Spring MVC
How to Check Json in Response Body With Mockmvc
How to Do a Limit Query in Jpql or Hql
Junit 5 - No Parameterresolver Registered for Parameter
Selecting from Div Class Dropdown - Selenium
How to Open a .Dat File in Java Program
Java Classnotfoundexception With Maven Dependency
Mockito - Nullpointerexception When Stubbing Method
In Java: How to Zip File from Byte[] Array
How to Set a Default Entity Property Value With Hibernate
Spring Boot Unsupported Media Type With @Requestbody
Java Stream Collectors.Groupingby() Multiple Fields
Field Required a Bean Which Could Not Be Found in Springboot
Set Zoom Level to 100% in Selenium Webdriver When Default Is Not 100
Jpa: Update Only Specific Fields