简而言之:我正在从 google place api 获取数据,并希望基于它在我的数据库中创建实体。我在用户名字段上有 @Email 注释,因此它不能包含空格。我试图使用这样的东西:
th:value="${#strings.trim(place.name) + '@mywebsite.com'}"
Run Code Online (Sandbox Code Playgroud)
但是,这似乎不起作用...我也尝试了不同的方法,只是为了仔细检查语法是否正确,例如:
th:value="${#strings.toLowerCase(place.name) + '@mywebsite.com'}"
Run Code Online (Sandbox Code Playgroud)
它的效果很好。
提前致谢!
我有以下模型(没有 getter 和 setter 以提高可读性):
@Entity
public class Recipe extends BaseEntity {
private String name;
private String description;
private Category category;
@OneToMany(mappedBy = "recipe", cascade = CascadeType.ALL)
private List<Ingredient> ingredients;
@OneToMany(mappedBy = "recipe", cascade = CascadeType.ALL)
private List<Instruction> instructions;
@ManyToMany
private List<User> administrators;
private int preparationTime;
private int cookTime;
public Recipe(){
super();
ingredients = new ArrayList<>();
instructions = new ArrayList<>();
administrators = new ArrayList<>();
}
public Recipe(String name, String description, Category category, int preparationTime, int cookTime) {
this();
this.name = …Run Code Online (Sandbox Code Playgroud)