use of com.xiaolyuh.entity.Person in project spring-boot-student by wyh-spring-ecosystem-student.
the class DataController method set.
@RequestMapping(value = "set", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void set() {
Person person = new Person("1", "wyf", 32);
personRepository.save(person);
personRepository.stringRedisTemplateDemo();
}
use of com.xiaolyuh.entity.Person in project spring-boot-student by wyh-spring-ecosystem-student.
the class PersonServiceImpl method save.
/**
* 测试事务的传递性
*
* @param person
* @return
*/
@Transactional
public Person save(Person person) {
Person p = personRepository.save(person);
try {
// 新开事务 独立回滚
selfProxyPersonService.delete();
} catch (Exception e) {
e.printStackTrace();
}
try {
// 使用当前事务 全部回滚
selfProxyPersonService.save2(person);
} catch (Exception e) {
e.printStackTrace();
}
personRepository.save(person);
return p;
}
use of com.xiaolyuh.entity.Person in project spring-boot-student by wyh-spring-ecosystem-student.
the class SpringBootStudentCacheRedis2ApplicationTests method testParse.
@Test
public void testParse() {
Person p = new Person();
p.setId(11L);
p.setAge(32);
// 表达式解析
ExpressionParser expressionParser = new SpelExpressionParser();
Expression expression = expressionParser.parseExpression("#person.age+\":\"+#person.id");
StandardEvaluationContext context = new StandardEvaluationContext();
context.setRootObject(p);
logger.info("[SpELTest - testParse ] {} ", expression.getValue(context));
Field[] fields = p.getClass().getDeclaredFields();
for (Field field : fields) {
try {
System.out.println("name:" + field.getName());
field.setAccessible(true);
System.out.println("value:" + field.get(p));
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
use of com.xiaolyuh.entity.Person in project spring-boot-student by wyh-spring-ecosystem-student.
the class PersonServiceImpl method findOne3.
@Override
// 3
@Cacheable(value = "people3")
public Person findOne3(Person person) {
Person p = personRepository.findOne(person.getId());
logger.info("为id、key为:" + p.getId() + "数据做了缓存");
return p;
}
use of com.xiaolyuh.entity.Person in project spring-boot-student by wyh-spring-ecosystem-student.
the class SpringBootStudentCacheRedisCaffeineApplicationTests method testParse.
@Test
public void testParse() {
Person p = new Person();
p.setId(11L);
p.setAge(32);
// 表达式解析
ExpressionParser expressionParser = new SpelExpressionParser();
Expression expression = expressionParser.parseExpression("#person.age+\":\"+#person.id");
StandardEvaluationContext context = new StandardEvaluationContext();
context.setRootObject(p);
logger.info("[SpELTest - testParse ] {} ", expression.getValue(context));
Field[] fields = p.getClass().getDeclaredFields();
for (Field field : fields) {
try {
System.out.println("name:" + field.getName());
field.setAccessible(true);
System.out.println("value:" + field.get(p));
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
Aggregations