shibboleth.InterceptFlow - share DB Connection Pooling with Shibboleth via 'global.xml'

Lionel Samuel lionel.samuel01 at gmail.com
Tue Sep 11 19:38:29 EDT 2018


Thank you. Works like a charm.

On Tue, Sep 11, 2018 at 2:17 AM Etienne Dysli Metref <
etienne.dysli-metref at switch.ch> wrote:

> On 11/09/18 03:05, Lionel Samuel wrote:
> > I have it working -- but with a DB connection in XML file local to
> > the JAR. Trying for last few days -- I can't figure out how to get
> > the global context and piggyback the Db connection/pooling in
> > 'global.xml' --- could anyone point me perhaps to an example?
>
> Why don't you let Spring know you want the DataSource bean (defined in
> global.xml) injected into your JdbcTemplate?
>
> > public ResetPasswordCounter() {
> >             super();
> >
> > ResetPasswordCounterLog.info("ResetPasswordCounter.constructor()",
> > "loading db-connection.xml ", null);
> >             this.context = new
> > ClassPathXmlApplicationContext("db-connection.xml");
> >             this.ResetPasswordCounterModel =
> > (ResetPasswordCounterJDBCTemplate)
> > context.getBean("resetPasswordCounterJDBCTemplate");
> >         }
>
> Then just have your code declare that it needs a
> ResetPasswordCounterJDBCTemplate instance and let Spring inject it.
> Calling context.getBean() is the wrong way to use the Spring Framework.
> Your constructor then becomes:
>
>     public ResetPasswordCounter(ResetPasswordCounterJDBCTemplate
> jdbcTemplate) {
>       super();
>       this.ResetPasswordCounterModel = jdbcTemplate;
>     }
>
> You'll also have to make sure Spring loads beans from your
> db-connection.xml (import from global.xml, for example), or just define
> them in global.xml (that's easier to start with). I'm not sure which of
> Spring package/annotation scanning is disabled in the IdP, but this is a
> bit more involved here than with Spring's full automation...
>
>   Etienne
>
> --
> For Consortium Member technical support, see
> https://wiki.shibboleth.net/confluence/x/coFAAg
> To unsubscribe from this list send an email to
> users-unsubscribe at shibboleth.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20180911/e92cb218/attachment.html>


More information about the users mailing list