springmvc踩坑-service文件没有标注且返回值null

在我们自动新建一个服务类时,因为方便,有时会忘记给类添加 @Service注解

甚至忘记 将返回值 添加好。

package com.ssm.crud.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ssm.crud.bean.Employee;
import com.ssm.crud.mapper.EmployeeMapper;

@Service
public class employeeService {

	@Autowired
	EmployeeMapper employeeMapper;
	
	public  List<Employee> getAll() {
        employeeMapper.selectByExampleWithDept(null);
		return null;
	}//上面这个地方 的返回值 默认是null  而我们需要的操作是 return  employeeMapper.selectByExampleWithDept(null);


}

 

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments