启动服务器报:but was actually of type 'com.sun.proxy.$Proxy23'错误

原因一:接口及实现类命名不规范
正确命名:
接口:

public interface Delivery_addressesService {
	public Delivery_addresses getByUser(int user_id);
	public Integer addressSave(int user_id,String address,String addressValue);
	public void createAddress(int user_id);
	
	public Integer addressSet(int user_id,String addressValue);
	
}

接口实现:

@Transactional
@Service(value="delivery_addressesService")
public class Delivery_addressesServiceI implements Delivery_addressesService {
	
	@Resource
	private Delivery_addressesMapper delivery_addressesMapper;
	@Resource
	private UsersMapper usersMapper;
	@Override
	public Delivery_addresses getByUser(int user_id) {
		Delivery_addresses delivery_addresses = delivery_addressesMapper.getByUser_id(user_id);
		return delivery_addresses;
	}
	@Override
	public Integer addressSave(int user_id, String address, String addressValue) {
			Delivery_addresses delivery_addresses = new Delivery_addresses();
			delivery_addresses.setUser_id(user_id);
			if(address.equals("addresses1")) {
				delivery_addresses.setAddresses1(addressValue);
			}
			if(address.equals("addresses2")) {
				delivery_addresses.setAddresses2(addressValue);
			}
			if(address.equals("addresses3")) {
				delivery_addresses.setAddresses3(addressValue);
			}
			if(address.equals("addresses4")) {
				delivery_addresses.setAddresses4(addressValue);
			}
			if(address.equals("addresses5")) {
				delivery_addresses.setAddresses5(addressValue);
			}
			delivery_addressesMapper.updateAddress(delivery_addresses);
		return 1;
	}
	@Override
	public Integer addressSet(int user_id, String addressValue) {
			Users users  =new Users();
			users.setId(user_id);
			users.setAddress(addressValue);
			usersMapper.update(users);
		return 1;
	}
	@Override
	public void createAddress(int user_id) {
			delivery_addressesMapper.createAddress(user_id);
		
	}

}

控制器:

@Controller
@RequestMapping("/address")
public class AddressController {
	@Resource
	private Delivery_addressesService delivery_addressesService;

你可能感兴趣的:(问题汇总)