在需要的方法或类名增加@Transactional(readOnly=true)
import org.springframework.transaction.annotation.Transactional;