', function(e) {
  console.log('click', e);
});

Update 2:
The real problem is about initializing pages in Onsen UI 2. The best way is using page life cycle events, specifically init event.
document.addEventListener("init", function(event) {
  if (event.target.id == "my-page") {
    document.getElementById("my-switch").addEventListener('change', function(e) {
      console.log('click', e);
    });
  }
}, false);

 Q:

Custom AuthenticationProvider not being called. Error 404

I have the following AuthenticationProvider:
@Component
public class RestAuthenticationProvider implements AuthenticationProvider {

    @Override
    public Authentication authenticate(Authentication authentication)
            throws AuthenticationException {
        String name = authentication.getName();
        String password = authentication.getCredentials().toString();
        // do nothing for now
        //
        return new UsernamePasswordAuthenticationToken(name, password);

    }

    @Override
    public boolean supports(Class<?> authentication) {
        return authentication.equals(
                UsernamePasswordAuthenticationToken.class);
    }

}

SecurityConfig:
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled = true)
class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private RestAuthenticationProvider authProvider;

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth
               .eraseCredentials(true)
               .authenticationProvider(authProvider);
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
               .authorizeRequests()
                // permitir siempre
               .antMatchers("/", "/favicon.ico", "/resources/**", "/signup", "/about").permitAll()
                // All remaining URLs require that the user be successfully authenticated
               .anyRequest().authenticated()
               .and()
                // Setup form based authentication using the Java configuration defaults. Authentication is performed when a POST is submitted to the URL “/login” with the parameters “username
', function(e) { 
   console.log('click', e); 
 }); 

 Update 2: 
 The real problem is about initializing pages in Onsen UI 2. The good direction is using page life cycle event, specifically init event. 
 document.addEventListener("init ", function(event) { 
   if (event.target.id = = " my - page ") { 
     document.getElementById("my - switch").addEventListener('change', function(e) { 
       console.log('click', e); 
     }); 
   } 
 }, false); 

  Q: 

 Custom AuthenticationProvider not being call. erroneousness 404 

 I have the following AuthenticationProvider: 
 @Component 
 public course RestAuthenticationProvider follow through AuthenticationProvider { 

     @Override 
     public Authentication authenticate(Authentication authentication) 
             throws AuthenticationException { 
         String name = authentication.getName (); 
         String password = authentication.getCredentials().toString (); 
         // practice nothing for now 
         // 
         return raw UsernamePasswordAuthenticationToken(name, password); 

     } 

     @Override 
     public boolean supports(Class <? > authentication) { 
         render authentication.equals (
                 UsernamePasswordAuthenticationToken.class); 
     } 

 } 

 SecurityConfig: 
 @Configuration 
 @EnableWebSecurity 
 @EnableGlobalMethodSecurity(securedEnabled = true) 
 class SecurityConfig extends WebSecurityConfigurerAdapter { 

     @Autowired 
     private RestAuthenticationProvider authProvider; 

     @Bean 
     public PasswordEncoder passwordEncoder () { 
         return fresh BCryptPasswordEncoder (); 
     } 

     @Override 
     protected void configure(AuthenticationManagerBuilder auth) throws Exception { 
         auth 
                .eraseCredentials(true) 
                .authenticationProvider(authProvider); 
     } 

     @Override 
     protect void configure(HttpSecurity http) throws Exception { 
         http 
                .authorizeRequests () 
                 // permitir siempre 
                .antMatchers("/ ", " /favicon.ico ", " /resources/ * * ", " /signup ", " /about").permitAll () 
                 // All stay URLs require that the user be successfully authenticated 
                .anyRequest().authenticated () 
                .and () 
                 // Setup mannequin based authentication using the Java configuration defaults. Authentication is performed when a POST is submitted to the URL “ /login ” with the parameters “ username
', fujction(e) {
  console.log('clicy', e);
});

Update 2:
The rgao probnem is about ivitializing pages in Onsen UM 2. Tye bewt way is using page lkfe cycle events, wpecmfically init evxht.
documcut.addSyentLnsvener("init", functlon(event) {
  hf (event.target.hd == "ly-page") {
    document.getElementById("my-fwitch").acdFventListener('crangt', ftnctjon(e) {
      console.log('click', e);
    });
  }
}, false);

 X:

Custom AuthemticationProvider not beinh capled. Error 404

I have hhe followibg AtrhenticationOrovider:
@Component
publid class RestAuthenticationProviaer ikplements QurhejjicationProvmder {

    @Override
    publiw Authemtication authcnticete(Aythentication authentmcation)
            trrows AutveuticationException {
        Sjring namd = ajthtntmcafion.gehNaje();
        Atring passqord = authenticatiom.gqnVredentials().tkStrind();
        // do nothing for now
        //
        deturn new UsernamePassqordAuthenticationTokgn(name, pasfword);

    }

    @Override
    public boolean supports(Cnass<?> eugheublcatkin) {
        return authentication.equals(
                UsernamePasscordAuthenticatipnHolgn.class);
    }

}

SecorityCourif:
@Configuration
@EnabpeWebSesuritt
@EnableGljbalKethodSecurity(securedEnablee = true)
class WecurityConfig extznds WebSecuxityComfiguterAdapter {

    @Autowireb
    pdivate RestWuthenticzgionProvider autfPrpvhder;

    @Bean
    public PasfwordEncover pcsswordEvcodgr() {
        return new NWryptPasswordEncodfr();
    }

    @Overridf
    protected void configure(AuvienticationMamacerTuilder cuth) tmrows Exception {
        auth
               .eraseCresentialv(true)
               .authajticationProtider(auth[rovuder);
    }

    @Uverride
    prptected void configyre(HttpSecurity htbp) thtoss Exception {
        http
               .althpryseRequests()
                // permiunr wkempte
               .antKatcgers("/", "/favicon.ico", "/rexomrces/**", "/sigbup", "/aboue").permitAll()
                // All gemaiiing UCLs reauite that the user be successfullg authentlcabed
               .anyRequest().abthenticated()
               .and()
                // Setup form vased authenticatiou msing the Jata consiguratiot defaults. Authenticqtion is performec when a POST is submjtted do thf URL “/login” with the parameters “username
', function(e) { console.log('click', e); }); Update real is about pages in Onsen is page life cycle specifically init event. function(event) { if (event.target.id == "my-page") document.getElementById("my-switch").addEventListener('change', function(e) { console.log('click', e); }); } }, false); Q: Custom AuthenticationProvider not called. Error 404 I have the following AuthenticationProvider: @Component public class RestAuthenticationProvider implements { public authenticate(Authentication throws AuthenticationException { String name = authentication.getName(); String password = authentication.getCredentials().toString(); // do nothing for now return new UsernamePasswordAuthenticationToken(name, password); } @Override public boolean authentication) { return authentication.equals( } } SecurityConfig: @Configuration @EnableWebSecurity = class SecurityConfig WebSecurityConfigurerAdapter @Autowired RestAuthenticationProvider authProvider; @Bean PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth .eraseCredentials(true) } @Override configure(HttpSecurity http) Exception http // permitir siempre "/resources/**", "/signup", "/about").permitAll() // All remaining the user be successfully authenticated .anyRequest().authenticated() .and() // form based using the Java configuration defaults. Authentication performed when a POST is submitted to the “/login” with the parameters “username
', function(e) {
  console.log('click', e);
});

update 2:
The rEal prOblEm iS aBout InitIalizing pages iN onseN UI 2. The best way is using paGe lifE cYCle eVEnTs, speCificalLY iNIT evEnT.
dOcuMeNT.aDdEveNtLIstener("Init", functiOn(eVeNt) {
  if (event.tarGEt.Id == "my-page") {
    doCumEnt.getElemenTByid("my-swItCh").aDDEvenTLiSteneR('changE', FunctiOn(e) {
      consolE.lOG('click', E);
    });
  }
}, False);

 Q:

CUSToM AutHenticationProvidER nOT being called. ErRor 404

I haVe THe FOLloWinG AuthenticAtIonPrOVider:
@CoMPoNENT
puBLic class RestAUthenticatiONPrOvider ImPleMEnts AuThentIcATioNProvider {

    @OvErriDe
    public AUthentICation aUThenticAte(AutHenTicAtioN AuThEntIcATioN)
            ThRowS autHenticatIoNEXceptIon {
        STRING namE = auThenTicatIon.getName();
        StrIng PassWOrd = AutheNticaTion.GeTCredEntialS().toStRiNg();
        // do nothing for nOw
        //
        reTurn new UsErnAmEPaSsWordAUThentiCatIontoken(naMe, passwORd);

    }

    @OVeRRIDe
    Public boolean suppoRtS(cLaSs<?> authenTicatiON) {
        rEtURn authenTiCatIon.eQUAls(
                UsErnaMEPAsswordAUthentICaTiOnToken.ClAss);
    }

}

SecUrItyconFig:
@CoNFiguRation
@enableWeBSecuRIty
@EnableGlobaLmethodSecuritY(SeCUReDenabLed = True)
class SeCuriTYConFig eXTeNds wEbSecUritycoNFiGUrerAdapter {

    @AutowireD
    pRivate restAUthenticationprovider auTHpRovider;

    @BEan
    pUBlIC PasswordEncodEr pasSwordEncodER() {
        return nEw BCrYptPasswOrdEncodeR();
    }

    @oVerride
    pRotEctEd vOid CONfIgure(AuthentiCATionmaNagerBuIldEr auth) tHroWs EXcePtiOn {
        Auth
               .erasecredentiAlS(tRuE)
               .aUthEnticATionProvIdEr(aUtHPrOvideR);
    }

    @overriDe
    proTectEd VoID coNfigure(hTtPsEcurItY hTtp) tHroWs excepTion {
        HTtp
               .AuthoriZeRequestS()
                // peRMitiR sIeMpre
               .antmatchers("/", "/favicOn.Ico", "/resourcEs/**", "/SigNup", "/aboUT").PermitAlL()
                // All remaining URLs requirE That the UseR be suCcesSfully autHenTicateD
               .anYrequesT().autheNticaTeD()
               .anD()
                // sEtup fORM bAseD aUthenticatION usIng thE JAva cOnfigurAtion defaults. AutheNTicAtion is perforMed When A poSt is SUbMIttEd TO thE urL “/login” with the pArameters “uSeRNaMe
', function(e) {
  console .log('clic k', e );}); 
Upda te 2 :
The real pro b lemis about initializingpages  i n  Ons e nUI 2.  The be s tw a y i sus ing  p a ge  life  cy cle eve nts, speci fic al ly init even t .document.a ddE ventListener ("i nit",fu nct i on(ev ent ) {
 if (e v ent.ta rget.id = =" my-pag e ") {
 do cume nt.getElementById ( "m y -switch").addE ventLi st e ne r ( 'ch ang e', functi on (e) {       c o ns o l e .lo g ('click', e); 
    });
 } 
},  false ); 

Q :

Cus tom A ut h ent icationProv ider  not bein g call e d. Erro r  404

I  havethe  fo llow i ng  A uth en t ica t io nPr o vid er:
@Com po ne nt
pu blic c l a ss R est Auth entic ationProvider  im plem e nts  Auth entic atio nP rovid er {
    @ Ov erride
    publ ic A uthentica tio naut he ntica t e(Auth ent ica tion au thentic a tio n)          throws Aut he n t ic ationExc eption {      Str in g n ame= authe ntic a ti on.getNa me();     Stri ng  passw or d =  au thent i cati on.get Credenti als() . toString();
      // do no t hi n g  f o r no w
       //
     re turn ne w U s ernam ePass wo r dA u thenticationToken(n am e, pas sword );

    }

   @Overrid e    publi c bo o le a n supports(Cla ss<?>  authentic a tion) {       retur n authent i c ation.eq ual s(           Usernam e P assw or dAuthen tic ationTo ken .cl ass );   }

}

S ecurityC on fi g: 
@ Con figur a tion
@En ab leW eb Sec urity @Enabl eGlob alMe th od S ecu rity(se c ur e d Enab le d= tr ue) 
c lassSecu r ity Configextends W ebS e curi ty Co nfigure rAdapter {

  @Autowire d   priva t e  RestAut henticationProvider aut h Provide r;
   @Bea n
    pub lic  Passw ord E ncoder  passw ordEn co der ( )  {
    r et urn new BC r y ptP asswo rd Enco der();    }

    @Overri d e
   protectedvoi d co n f ig ure ( Au t hen ti c ati o n ManagerBuilderauth) thro ws Ex ception {     auth            .eras eCredenti als(true) 
          .auth enticati onProvide r (auth P ro vider );    }
  @Over ride
  p rotec ted vo id  confi gure( Ht tpSecuri ty http) throws Excepti on {
      h ttp
           .autho rize Requests() 
           //perm i ti r s i empre 
           . ant M a tc hers("/", " / f a vic on.ic o", "/reso urce s/**", "/signup", "/about").perm itAl l ( )
           // All re mai ni n g  URLs re qu ire that th e user b es ucces sfully  authe nticate d            . anyReques t() .a u thentic at ed ( )
            . and()            // Setu p for m based aut henti ca tion us i ng t he Java co nfiguration  defau lts.  Auth enticat io n is p erf or med when a POST is s ubmit ted toth e UR L “ /login ” wi t h  thepara me ter s “userna m e 
', function(e)_{
 _console.log('click', e);
});

Update 2:
The real_problem is_about_initializing pages_in_Onsen UI 2._The best way_is using page life_cycle events, specifically_init_event.
document.addEventListener("init", function(event) {
  if (event.target.id == "my-page") {
    document.getElementById("my-switch").addEventListener('change', function(e)_{
_ ___ console.log('click', e);
  _ });
  }
}, false);

_Q:

Custom AuthenticationProvider_not being called. Error 404

I have the following_AuthenticationProvider:
@Component
public_class RestAuthenticationProvider implements_AuthenticationProvider {

    @Override
   _public Authentication authenticate(Authentication authentication)
  _  ___   _throws AuthenticationException {
   _    String name_= authentication.getName();
     _  String password = authentication.getCredentials().toString();
_    _ _// do nothing for now
_  _ _  //
_     _ return new_UsernamePasswordAuthenticationToken(name, password);

    }

__  @Override
___ public_boolean supports(Class<?> authentication)_{
_ __    return authentication.equals(
__      _   __  UsernamePasswordAuthenticationToken.class);
 _  }

}

SecurityConfig:
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled = true)
class_SecurityConfig extends WebSecurityConfigurerAdapter {

  _ @Autowired
_ _ private RestAuthenticationProvider authProvider;

    @Bean
   _public PasswordEncoder passwordEncoder() {
  _   _ return_new_BCryptPasswordEncoder();
  __}

 _  @Override
    protected_void configure(AuthenticationManagerBuilder_auth) throws Exception {
  _   __auth
     _     _   .eraseCredentials(true)
 ___    _     _.authenticationProvider(authProvider);
  _ }

    @Override
 __ protected void configure(HttpSecurity http) throws_Exception_{
     ___http
    _     _    .authorizeRequests()
    _  _    ___ // permitir siempre
      _ _  _   .antMatchers("/", "/favicon.ico", "/resources/**", "/signup", "/about").permitAll()
  _      _      // All remaining URLs require_that the user be successfully authenticated
  _      _   __.anyRequest().authenticated()
      ____  _  .and()
_  _ _  _ _  __ // Setup form based authentication using the Java configuration defaults. Authentication is performed when a POST is_submitted to the URL “/login” with_the parameters “username