*************************** APPLICATION FAILED TO START *************************** Description: Field repeatSubmitInterceptor in com.example.pmp.config.ResourcesConfig required a bean of type 'com.example.pmp.interceptor.RepeatSubmitInterceptor' 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 'com.example.pmp.interceptor.RepeatSubmitInterceptor' in your configuration.
时间: 2023-07-23 12:08:18 浏览: 161
您好!根据您提供的错误信息,似乎是在配置资源时出现了问题。
根据错误信息,字段`repeatSubmitInterceptor`在`com.example.pmp.config.ResourcesConfig`类中需要一个名为`com.example.pmp.interceptor.RepeatSubmitInterceptor`的bean,但是在配置中找不到该bean。
解决这个问题的方法是,在您的配置文件中定义一个名为`com.example.pmp.interceptor.RepeatSubmitInterceptor`的bean。您可以通过在配置类上添加注解`@Bean`来创建该bean。例如:
```java
@Configuration
public class ResourcesConfig {
@Bean
public RepeatSubmitInterceptor repeatSubmitInterceptor() {
return new RepeatSubmitInterceptor();
}
// 其他配置代码...
}
```
通过以上方式,您可以创建一个名为`repeatSubmitInterceptor`的bean,并将其注入到`ResourcesConfig`中。
如果问题仍然存在,请提供更多相关的代码或错误信息,以便我能更好地帮助您解决问题。
相关问题
*** [app] Error 1
As an AI language model, I cannot provide a specific answer without more context. However, "Error 1" in software development usually indicates that the build or compilation process has failed due to a critical error. This error message can appear when compiling source code, installing software packages, or executing scripts. The cause of this error can vary depending on the application, programming language, and development environment. Developers can usually find more information about the error by examining the build log or error message output.
C语言参数 封装IDispatch*入参 并返回
在 C 语言中,使用 IDispatch 接口封装对象可以实现对象的方法调用和属性访问。在函数中,我们可以通过传递 IDispatch* 类型的指针参数来访问和修改对象的属性和方法。函数也可以通过返回 IDispatch* 类型的指针来返回一个封装对象的实例。
以下是一个示例代码,演示了如何使用 IDispatch 接口封装对象来传递参数并返回对象:
```c
#include <stdio.h>
#include <windows.h>
IDispatch* create_object() {
CLSID clsid;
HRESULT hr = CLSIDFromProgID(L"Excel.Application", &clsid);
if (FAILED(hr)) {
return NULL;
}
IDispatch* pExcel = NULL;
hr = CoCreateInstance(&clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IDispatch, (void**) &pExcel);
if (FAILED(hr)) {
return NULL;
}
return pExcel;
}
void set_cell_value(IDispatch* pWorksheet, int row, int col, LPWSTR value) {
DISPID dispId;
BSTR propName = SysAllocString(L"Cells");
VARIANT result;
VariantInit(&result);
DISPPARAMS params = { 0 };
VARIANT args[2];
args[0].vt = VT_I4;
args[0].lVal = row;
args[1].vt = VT_I4;
args[1].lVal = col;
params.cArgs = 2;
params.rgvarg = args;
HRESULT hr = pWorksheet->GetIDsOfNames(IID_NULL, &propName, 1, LOCALE_SYSTEM_DEFAULT, &dispId);
if (FAILED(hr)) {
return;
}
hr = pWorksheet->Invoke(dispId, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, ¶ms, &result, NULL, NULL);
if (FAILED(hr)) {
return;
}
IDispatch* pCell = result.pdispVal;
if (pCell == NULL) {
return;
}
propName = SysAllocString(L"Value");
VARIANTARG valueArg;
valueArg.vt = VT_BSTR;
valueArg.bstrVal = SysAllocString(value);
DISPID putDispId;
hr = pCell->GetIDsOfNames(IID_NULL, &propName, 1, LOCALE_SYSTEM_DEFAULT, &putDispId);
if (FAILED(hr)) {
return;
}
params.cArgs = 1;
params.rgvarg = &valueArg;
hr = pCell->Invoke(putDispId, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, ¶ms, NULL, NULL, NULL);
if (FAILED(hr)) {
return;
}
SysFreeString(propName);
VariantClear(&result);
}
int main() {
IDispatch* pExcel = create_object();
if (pExcel == NULL) {
printf("Failed to create Excel instance.\n");
return 1;
}
BSTR propName = SysAllocString(L"ActiveWorkbook");
DISPID dispId;
HRESULT hr = pExcel->GetIDsOfNames(IID_NULL, &propName, 1, LOCALE_SYSTEM_DEFAULT, &dispId);
if (FAILED(hr)) {
printf("Failed to get ActiveWorkbook property.\n");
return 1;
}
VARIANT result;
VariantInit(&result);
hr = pExcel->Invoke(dispId, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, NULL, &result, NULL, NULL);
if (FAILED(hr)) {
printf("Failed to invoke ActiveWorkbook property.\n");
return 1;
}
IDispatch* pWorkbook = result.pdispVal;
if (pWorkbook == NULL) {
printf("Failed to get workbook instance.\n");
return 1;
}
propName = SysAllocString(L"ActiveSheet");
hr = pWorkbook->GetIDsOfNames(IID_NULL, &propName, 1, LOCALE_SYSTEM_DEFAULT, &dispId);
if (FAILED(hr)) {
printf("Failed to get ActiveSheet property.\n");
return 1;
}
VariantClear(&result);
hr = pWorkbook->Invoke(dispId, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, NULL, &result, NULL, NULL);
if (FAILED(hr)) {
printf("Failed to invoke ActiveSheet property.\n");
return 1;
}
IDispatch* pWorksheet = result.pdispVal;
if (pWorksheet == NULL) {
printf("Failed to get worksheet instance.\n");
return 1;
}
set_cell_value(pWorksheet, 1, 1, L"Hello");
set_cell_value(pWorksheet, 1, 2, L"World");
pWorksheet->Release();
pWorkbook->Release();
pExcel->Release();
return 0;
}
```
在这个示例中,我们使用 IDispatch 接口封装了一个 Excel.Application 对象,并使用 create_object 函数来创建对象实例。我们还定义了 set_cell_value 函数来设置单元格的值。该函数接受一个 IDispatch* 类型的指针参数,该参数指向一个 Excel.Worksheet 对象。在函数内部,我们使用 GetIDsOfNames 和 Invoke 函数来访问单元格对象,并使用 SetProperty 函数来设置单元格的值。最后,我们在 main 函数中调用 set_cell_value 函数来设置单元格的值,并释放对象实例。
阅读全文