eclipse使用lombok的一个坑 无法找到set、get方法

一、项目运行会报这个错

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2023-03-11 11:34:36.931 +0800 [ERROR] [main] [o.springframework.boot.SpringApplication] [-] [-] [] Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'beanNameHandlerMapping' defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '/reportOdaService': Cannot resolve reference to bean 'reportOdaService' while setting bean property 'service'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'reportOdaService': Unsatisfied dependency expressed through field 'reportAdapterList'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'acoDetailReportService': Unsatisfied dependency expressed through field 'changeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'changeService': Unsatisfied dependency expressed through field 'custEngineerPartDesignService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custEngineerPartDesignService': Unsatisfied dependency expressed through field 'partService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'partService': Unsatisfied dependency expressed through field 'colorService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'colorService': Unsatisfied dependency expressed through field 'custColorSchemeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custColorSchemeService': Unsatisfied dependency expressed through field 'colorIECodeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'colorIECodeService': Unsatisfied dependency expressed through field 'colorSchemeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'colorSchemeService': Unsatisfied dependency expressed through field 'partAssemblyService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'partAssemblyService': Unsatisfied dependency expressed through field 'productNodeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'productNodeService': Unsatisfied dependency expressed through field 'productTypeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'productTypeService': Unsatisfied dependency expressed through field 'productStructureService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'productStructureService': Unsatisfied dependency expressed through field 'changeOperationService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'changeOperationService': Unsatisfied dependency expressed through field 'custEngineerChangeOrderService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custEngineerChangeOrderService': Unsatisfied dependency expressed through field 'releaseChangeService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'releaseChangeService': Unsatisfied dependency expressed through field 'custChangeActionService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custChangeActionService': Unsatisfied dependency expressed through field 'custPartAssemblyService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custPartAssemblyService': Unsatisfied dependency expressed through field 'attachRecordAdapterService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'attachRecordAdapterService': Unsatisfied dependency expressed through field 'plantLayoutService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'plantLayoutService': Unsatisfied dependency expressed through field 'plantLayoutService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custPlantLayoutService': Unsatisfied dependency expressed through field 'custSapPlantService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custSapPlantService': Unsatisfied dependency expressed through field 'custReceivedVehicleService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custReceivedVehicleService': Unsatisfied dependency expressed through field 'partAssemblyDrivenService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'partAssemblyDrivenService': Unsatisfied dependency expressed through field 'compositePartAdapterService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compositePartAdapterService': Unsatisfied dependency expressed through field 'partSupplyService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'partSupplyService': Unsatisfied dependency expressed through field 'custMaterialInfoService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custMaterialInfoService': Unsatisfied dependency expressed through field 'custMaterialBomService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custMaterialBomService': Unsatisfied dependency expressed through field 'colorBomAdapterService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'colorBomAdapterService': Unsatisfied dependency expressed through field 'colorBomAdapterService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custColorBomAdapterService': Unsatisfied dependency expressed through field 'engineerPartDesignService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'engineerPartDesignService': Unsatisfied dependency expressed through field 'custPartService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custPartService': Unsatisfied dependency expressed through field 'taskService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fwTaskService': Unsatisfied dependency expressed through field 'timingTaskHandleList'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'custSapTaskQueueTimingTask': Unsatisfied dependency expressed through field 'custSapIntegrationService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'custSapIntegrationService' defined in file [C:\MyWorksEclipse\workspace\BYD_CAR_PVBOM\prj-cust-app\bin\com\gantang\cust\integration\sap\service\impl\CustSapIntegrationServiceImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.gantang.cust.integration.sap.service.impl.CustSapIntegrationServiceImpl]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problems: 
	The method setMasterPartId(Long) is undefined for the type CustSapMasterPartDto
	The method setMaterialNo(String) is undefined for the type CustSapMasterPartDto
	The method getSapMasterPartDto() is undefined for the type CustSapTaskDetailResultDto
	The method getSapEcns() is undefined for the type CustSapTaskDetailResultDto
	The method setSapTaskDetailId(String) is undefined for the type QueryBomJsonRequest
	The method setBomChangeCode(String) is undefined for the type QueryBomJsonRequest
	The method setSapTaskDetailId(String) is undefined for the type CreateBomJsonRequest
	The method setBomChangeCode(String) is undefined for the type CreateBomJsonRequest
	The method getSapEcns() is undefined for the type CustSapTaskDetailResultDto
	The method setSapTaskDetailId(String) is undefined for the type UpdateBomJsonRequest
	The method setBomChangeCode(String) is undefined for the type UpdateBomJsonRequest
	The method setSendResult(boolean) is undefined for the type CustSapTaskDetailResultDto
	The method getSapTaskDetailId() is undefined for the type CustSapTaskDetailResultDto
	The method isSendResult() is undefined for the type CustSapTaskDetailResultDto
	The method getSapMasterPartDto() is undefined for the type CustSapTaskDetailResultDto
	The method getSapEcns() is undefined for the type CustSapTaskDetailResultDto
	The method getMasterPartId() is undefined for the type CustSapMasterPartDto
	The method getMaterialNo() is undefined for the type CustSapMasterPartDto
	The method getMasterPartId() is undefined for the type CustSapMasterPartDto
	The method getMaterialNo() is undefined for the type CustSapMasterPartDto
	The method getFldelete() is undefined for the type UpdateBomStpoDto
	The method map(Function<? super UpdateBomStpoDto,? extends R>) in the type Stream<UpdateBomStpoDto> is not applicable for the arguments (UpdateBomStpoDto::getItemText2)
	The type UpdateBomStpoDto does not define getItemText2(UpdateBomStpoDto) that is applicable here
	The method getItemText2() is undefined for the type UpdateBomStpoDto
	The method getItemText2() is undefined for the type UpdateBomStpoDto
	The method setChangeNo(String) is undefined for the type UpdateBomStpoDto
	The method setChangeNo(String) is undefined for the type UpdateBomStpoDto
	The method setSendResult(boolean) is undefined for the type CustSapTaskDetailResultDto
	The method getSapTaskDetailId() is undefined for the type CustSapTaskDetailResultDto
	The method isSendResult() is undefined for the type CustSapTaskDetailResultDto

	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:372)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
	at grails.boot.GrailsApp.run(GrailsApp.groovy:83)
	at grails.boot.GrailsApp.run(GrailsApp.groovy:388)
	at grails.boot.GrailsApp.run(GrailsApp.groovy:375)
	at grails.boot.GrailsApp$run.call(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
	at prj.cust.app.Application.main(Application.groovy:8)

二、尝试解决

尝试一、运行lombok.jar包 --失败
尝试二、eclipse.ini加信息 --失败
尝试三、勾选那两个对勾 --成功
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 使用lombok的时候,如果找不到枚举的get方法,有以下几种可能的原因和解决办法: 1. 枚举类的定义问题:首先要确认枚举类是否正确定义了相应的get方法Lombok通常会根据属性自动生成get方法,但是对于枚举,由于其特殊性,可能需要手动定义get方法。 2. Lombok的版本问题:确定所使用的Lombok版本是否与项目的其他依赖或配置相兼容。有时候不同的Lombok版本在处理枚举的方式上会有一些差异,因此确认版本是否一致或尝试更新Lombok版本可能有助于解决问题。 3. IDE的插件问题:检查IDE使用的Lombok插件是否已正确安装和启用。Lombok提供了对IDE的插件支持,以便在编译时生成getter和setter等方法。确保插件已正确安装并启用,以便正确生成get方法。 4. 编译问题:重新编译项目并确保没有编译错误。有时候编译错误或配置错误可能导致Lombok无法生成相应的get方法。重新编译项目可以解决这个问题。 如果上述方法都没有解决问题,建议在具体情况下进一步检查代码和相关配置,或寻求Lombok相关的文档、社区或支持渠道的帮助。 ### 回答2: 使用lombok时找不到枚举的get方法可能是因为在枚举类使用了`@Getter`注解,而枚举类的成员默认都是public static final类型,可以直接通过枚举名称访问,无需通过get方法。 假如枚举类代码如下: ``` @Getter public enum MyEnum { VALUE1, VALUE2, VALUE3; } ``` 在使用lombok的情况下,可以直接通过枚举名称访问: ``` MyEnum myEnum = MyEnum.VALUE1; System.out.println(myEnum); ``` 此时就可以正确输出枚举的值VALUE1了。 另外,如果在枚举类定义了成员变量,并且使用了`@Getter`注解,那么lombok会自动生成get方法。如以下代码: ``` @Getter public enum MyEnum { VALUE1("A"), VALUE2("B"), VALUE3("C"); private String code; MyEnum(String code) { this.code = code; } } ``` 在此情况下,就可以通过get方法获取枚举类的成员变量了: ``` MyEnum myEnum = MyEnum.VALUE1; System.out.println(myEnum.getCode()); ``` 上述代码将输出枚举类VALUE1的成员变量code的值"A"。所以,如果使用lombok找不到枚举的get方法,可以先确保枚举的成员是public static final类型,然后尝试直接通过枚举名称来访问。如果枚举类定义了成员变量,可以使用get方法来获取成员变量的值。 ### 回答3: 使用Lombok时找不到枚举的get方法可能是因为以下几个可能原因: 1. 枚举类未定义相应字段或get方法Lombok会根据Java类的字段自动生成相应的getter和setter方法,如果枚举类未定义相应字段或get方法,可能会导致找不到相应的get方法。 2. Lombok的版本不兼容:不同版本的Lombok在生成getter和setter方法时可能有一些差异,如果使用的Lombok版本与IDE或编译器不兼容,可能会导致找不到枚举的get方法。 3. IDE或编译器设置问题:有些IDE或编译器可能需要手动设置才能正确识别和生成Lombok的注解,如果没有正确设置,可能会导致找不到枚举的get方法。 针对以上问题,可以尝试以下解决方法: 1. 确认枚举类定义了需要的字段或get方法,如果没有定义,可以手动添加相应的字段和get方法。 2. 更新Lombok的版本,确保Lombok的版本与IDE或编译器兼容。 3. 检查IDE或编译器的设置,确保已经正确配置Lombok的注解处理,例如在IDE可以确认是否安装了Lombok插件,并启用了注解处理功能。 4. 如果以上方法仍然不能解决问题,可以尝试使用传统的方式手动编写枚举类的get方法,或者考虑使用其他的代码生成工具代替Lombok

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值