As per the project requirement , I am going to migrate spring boot application from Springboot 2.7.6 to 3.0.0 version.
I have modified the below changes.
Changed the java version from java 11 to 17. i have modifed the spring boot starter parent version from 2.7.6 to 3.0.0 version.
I am able to build the application ,While starting the server getting the issue as below.
Issue Description::
APPLICATION FAILED TO START
※ネバネネネぶぶぶぶぶぶぶぶ※メススメネススメポポポン
Description:
Parameter 0 of constructor in jp.co.metlife.mis.service.EventLogService required a bean of type 'jp.co.metlife.mis.repository.EventLogRepository' that could not be found
The injection point has the following annotations:
@org-springframework.beans. factory.annotation. Autowired(required-true)
Action:
Consider defining a bean of type "jp.co-metlife.mis.repository-EventLogRepository' in your configuration.
Service Class:
public class EventLogService {
private final EventLogRepository eventLogRepository;
private static final String COSMOS DB_SAVE ERROR MESSAGE - "Error while saving event log in Cosmos DB";
private static final Logger logger =Logger. in(EventLogService.class);
public EventLogService (EventLogRepository eventLogRepository) {
this .eventLogRepository =eventLogRepository;
}
public void logEvent (EventName eventName, EventStatus eventStatus){
saveEvent (eventStatus,
new EventLog(eventName-getDescription(), eventStatus • getDescription()));
DAO Class:
import com.azure. spring. data. cosmos. repository.CosmosRepository;
import jp.co.metlife.mis.entity. EventLog;
import org-springframework.data.repository .CrudRepository:
import org. springframework. stereotype. Repository
@repository
public interface EventLogRepository extends CrudRepository<EventLog, String>, CosmosRepository<EventLog, String>{
}
Comment From: wilkinsona
Thanks for the report. Unfortunately, two code snippets and an error message aren't enough for us to diagnose the problem. If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: nagaraju1692
Sorry ,for me GitHub restricted, So that i am not able to share entire code. Here my application working fine with out any issue with spring boot version 2.7.6 version . The security venerability team has been raised issue with spring-web 5.3 version . Now i just upgrading the spring-web version from spring-web5.3 to 6.X version.
For this , I have done the below changes. 1) Changed the java version 1.8 to 17. 2) Spring boot starter parent jar upgrade the from 2.7.2 to 3.0.0, and then spring 6.X framework downloading automatically.
Build was successful, But when i run the server getting error as above.
Kindly let me know, If i am going correct way or is there any alternative way to migrate the spring-web jar from 5.x to 6.x.
Comment From: philwebb
@nagaraju1692 We don't require the entire codebase, we really just need a small sample application that replicates the problem. It also doesn't need to be a GitHub project, you can attach a zip file to this issue.
The error suggests that the EventLogRepository bean is not being created, but without something that we can run or debug there's very little that we can do to help you.
Comment From: nagaraju1692
Could you please confirm which azure cosmos data base version supported to the spring boot 3.0.0 version ?
Comment From: wilkinsona
It's a third-party project maintained by Microsoft so it's we're not best-placed to answer questions about it. It looks like they only support Spring Boot 2.7 at the moment (https://github.com/Azure/azure-sdk-for-java/blob/12bf4ba761b4ff4fbc1bcc6f683525eced2712fa/sdk/cosmos/azure-spring-data-cosmos/pom.xml#L132-L143).