Monti

[오류]org.springframework.beans.factory.NoSuchBeanDefinitionException 본문

Spring/오류해결

[오류]org.springframework.beans.factory.NoSuchBeanDefinitionException

montt 2021. 6. 16. 12:11

이 오류는 Service 객체를 찾을 수 없어서나타나는 오류이다.

쉽게 해결할 수 있는데

작성한 Service에서 이노테이션 @Service를 정의해주면 바로 해결이 된다.

 

@서비스 정의

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
@Service("admin.productmanage.productManageService")
public class ProductManageServiceImpl implements ProductManageService{
    @Autowired    productDAO dao;
 
    @Autowired
    private FileManager fileManager;
 
    @Override
    public void insertProduct(Product dto, String pathname) throws Exception {
 
        try {
 
            String saveFilename = fileManager.doFileUpload(dto.getUpload(), pathname);
            if (saveFilename != null) {
                dto.setImg_name(saveFilename);
            }
            dao.insertData("product.insert_product", dto);
            dao.insertData("product.insert_product_image", dto);
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }
    }    
}
 
cs
Comments