<div dir="ltr"><div>Thank you. Works like a charm. <br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Sep 11, 2018 at 2:17 AM Etienne Dysli Metref <<a href="mailto:etienne.dysli-metref@switch.ch">etienne.dysli-metref@switch.ch</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 11/09/18 03:05, Lionel Samuel wrote:<br>
> I have it working -- but with a DB connection in XML file local to<br>
> the JAR. Trying for last few days -- I can't figure out how to get<br>
> the global context and piggyback the Db connection/pooling in<br>
> 'global.xml' --- could anyone point me perhaps to an example?<br>
<br>
Why don't you let Spring know you want the DataSource bean (defined in<br>
global.xml) injected into your JdbcTemplate?<br>
<br>
> public ResetPasswordCounter() {<br>
>             super();<br>
>            <br>
> ResetPasswordCounterLog.info("ResetPasswordCounter.constructor()",<br>
> "loading db-connection.xml ", null);<br>
>             this.context = new<br>
> ClassPathXmlApplicationContext("db-connection.xml");<br>
>             this.ResetPasswordCounterModel =<br>
> (ResetPasswordCounterJDBCTemplate)<br>
> context.getBean("resetPasswordCounterJDBCTemplate");<br>
>         }<br>
<br>
Then just have your code declare that it needs a<br>
ResetPasswordCounterJDBCTemplate instance and let Spring inject it.<br>
Calling context.getBean() is the wrong way to use the Spring Framework.<br>
Your constructor then becomes:<br>
<br>
    public ResetPasswordCounter(ResetPasswordCounterJDBCTemplate<br>
jdbcTemplate) {<br>
      super();<br>
      this.ResetPasswordCounterModel = jdbcTemplate;<br>
    }<br>
<br>
You'll also have to make sure Spring loads beans from your<br>
db-connection.xml (import from global.xml, for example), or just define<br>
them in global.xml (that's easier to start with). I'm not sure which of<br>
Spring package/annotation scanning is disabled in the IdP, but this is a<br>
bit more involved here than with Spring's full automation...<br>
<br>
  Etienne<br>
<br>
-- <br>
For Consortium Member technical support, see <a href="https://wiki.shibboleth.net/confluence/x/coFAAg" rel="noreferrer" target="_blank">https://wiki.shibboleth.net/confluence/x/coFAAg</a><br>
To unsubscribe from this list send an email to <a href="mailto:users-unsubscribe@shibboleth.net" target="_blank">users-unsubscribe@shibboleth.net</a></blockquote></div>