grails - Injecting a SpringSecurityService into a Java class -


When we modify it, we note that one service should implement the interface, then, Java class this interface Will depend on.

But, what about Grails-service that is a built-in service or is there a ready plugin available?

How to let go implements an interface and then implementing in the settings resources. Groovy

i.e.:


The following is not the IoC pattern because the person.java class depends on the class not on the interface:

  import Do the grails.plugin.springsecurity.SpringSecurityService; Class person {spring security ss; }  

The following IoC pattern is: If we apply the class SpringSecurityService IGService for example {/*...*/}

  import grails.facade.IGService class person {IGService sss; }  

Then, in resources.groovy , we have:

  person (slm.abdennour.Person) {sss} = SpringSecurityService}    

I am getting the solution, and I want to share it:

  Import grails.plugin.springsecurity.SpringSecurityService; Import grails.facade.IGService; Class Customer SSS SpringSecurityService applies to IGService {}  

then, in resources.groovy :

  springSecurityService {CustomerSSS} { ('UserDetailsService'  

Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -