Skip to content

Instantly share code, notes, and snippets.

@sonOfRa
Created April 14, 2020 11:23
Show Gist options
  • Save sonOfRa/bb0e8f3f7d31d365f1bf33ccc49b32c4 to your computer and use it in GitHub Desktop.
Save sonOfRa/bb0e8f3f7d31d365f1bf33ccc49b32c4 to your computer and use it in GitHub Desktop.
package de.slevermann.cocktails.services;
import de.slevermann.cocktails.daos.IngredientDao;
import de.slevermann.cocktails.models.Ingredient;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
@Service
@Transactional
@Validated
public class IngredientService {
private IngredientDao ingredientDao;
public IngredientService(IngredientDao ingredientDao) {
this.ingredientDao = ingredientDao;
}
public Long createIngredient(@Valid Ingredient ingredient) {
return ingredientDao.insert(ingredient);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment