I have a session object which contains a reference to another object that I do not wish to 开发者_如何学Cserialize. Is it possible to do so using annotations?
@Component
public class Model implements Serializable{
private static final long serialVersionUID = 1L;
@Autowired
private Validator validator;
Thanks in advance,
You can mark it with transient
, though it would be null
after deserialization.
You can also move the validation out of the POJO into a helper class. You could use the validation annotations from javax.validation describe in JSR-303. Here is a howto link: http://www.openscope.net/2010/02/08/spring-mvc-3-0-and-jsr-303-aka-javax-validation/
精彩评论