开发者

Testing injected dependencies into your struts2 actions

开发者 https://www.devze.com 2022-12-22 23:24 出处:网络
I am wondering how others might have accomplished this. I found in the Spring documentation @required which I attempted to use in a \'test\' but got this stmt INFO XmlConfigurationProvider:380 - Unabl

I am wondering how others might have accomplished this. I found in the Spring documentation @required which I attempted to use in a 'test' but got this stmt INFO XmlConfigurationProvider:380 - Unable to verify action class [xxx] exists at initialization

I have found another way in spring to do this is to write custom init methods and declare those on the bean but it almost seems like this is a strange thing to do to a struts2开发者_如何学JAVA action.

In my application I inject through spring different web services (via setter injection) into different actions. I want to ensure on startup these are not null and set.


Use request or session spring scopes.

Then you can do the checks in a @PostConstruct method, what will you do there? Throw an exception? Well, something isn't set you will eventually get a NullPointerException.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号