java - Overriding a custom WebSecurityConfigurerAdapter causes both to be instantiated -
here's situation: have project has using spring security. working well.
i have this:
@configuration @enablewebsecurity @enableglobalmethodsecurity(prepostenabled = true, securedenabled = true) public class securityconfig extends websecurityconfigureradapter { public authenticationfailurehandler getauthenticationfailurehandler(){ return new plainfailurehandler(); } @override protected void configure(httpsecurity httpsec) throws exception { authfilter filter = new authfilter(getauthenticationfailurehandler()); filter.setauthenticationmanager(authenticationmanagerbean()); httpsec.addfilterbefore(filter, usernamepasswordauthenticationfilter.class); } } and far, great. now, have second project built on top of first project.
in it, need override authenticationfailurehandler.
i created new class in second project, , looks similar:
@configuration @enablewebsecurity @enableglobalmethodsecurity(prepostenabled = true, securedenabled = true) public class newprojectsecurityconfig extends securityconfig { @override public authenticationfailurehandler getauthenticationfailurehandler() { return new newprojectauthenticationfailurehandler(); } } and problem spring instantiating both of them, resulting in 2 filters. can add @order(1) make sure 1 gets done before other, want only use second config, , somehow tell spring use instead of first. i'm still new spring, apologize if i've missed 'bigger picture' item. i'm unable change project 1, can't remove original config , duplicate it.
note: not using config files @ all, done programatically.
Comments
Post a Comment