UserService.java
package com.kinsey.woo.service.impl;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.kinsey.woo.dto.User;
import com.kinsey.woo.service.UserService;
@Service("userService")
@Cacheable(value="users",key="#name")
public class UserServiceImpl implements UserService {
public User getUserByNameAndAge(String name,int age){
System.out.print("getUserByNameAndAge is called...\n");
return new User(name,age);
}
@Override
public User getAntherUser(String name, int age) {
System.out.println("getAntherUser is called...\n");
return new User(name,age);
}
}