手记

使用@postconstruct注解和声明init-method的区别

原问题为:

Is there any difference between using the @PostConstruct annotation and declaring the same method as init-method in Spring XML configuration?

原网址
节选最简单的答案:

@postconstruct is not part of the spring. It is part of javax package. Both are the same. using init-method we need to added in xml file.If you use @postconstruct adding in xml is not required. Check out the below article .

@postconstruct注解的使用 Demo

0人推荐
随时随地看视频
慕课网APP