0

My question is: would it make sens to use a tutorial like this (point 5) considering I'm using the JSF framework ? I know spring and jsf shouldn't be mixed up but I don't know where to draw the line really.

In the spring security documentation they inject the datasource for the JDBC authentication like this:

@Autowired private DataSource dataSource; // This, I don't know what to do

@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth
        .jdbcAuthentication()
            .dataSource(dataSource)
            .withDefaultSchema()
            .withUser("user").password("password").roles("USER").and()
            .withUser("admin").password("password").roles("USER", "ADMIN");
}

I'm using JSF and my datasource is specified nowhere and I'm kinda relunctant to use spring related techniques because of this : Using JSF as view technology of Spring MVC

Community
  • 1
  • 1
Ced
  • 15,847
  • 14
  • 87
  • 146
  • Do you have a provider for the `DataSource`? Do you know how Spring works by itself? – Luiggi Mendoza May 21 '15 at 16:45
  • Wherw is this jsf related? I only see spring/java code in the example – Kukeltje May 21 '15 at 16:53
  • @Luiggi no, not really, I guess I've to declare my datasource in an application-contyext? – Ced May 21 '15 at 17:04
  • Yes, you must declare the datasource bean in a Spring XML config file or use a `@Configuration` class that provides a datasource through `@Bean`. I recommend you to review Spring first, then start using other frameworks on top of it like Spring Security. – Luiggi Mendoza May 21 '15 at 17:13
  • But I'm using JSF which I think means I'll only use spring security for the security. The rest will be handled by jsf. – Ced May 21 '15 at 17:21
  • You do not use any other spring things? Any specific reason to use it then and not some other framework (not that spring-security is bad) – Kukeltje May 21 '15 at 17:25
  • None, I just heard about it. The vanilla java ee security system is bad though. But since I started with it (spring security) I should keep on. Furthermore I read that I didn't especially need to know the spring framework to get going. I just need to figure out how to configure this datasource thing then I can keep on coding my web app and maybe come back on the security in the future. But at the moment I would like to build my web app though. I just learned JSF framework to do so. – Ced May 21 '15 at 18:05
  • @Kukeltje This post from BalusC seems to say (last paragraph) that jsf is relevant. http://stackoverflow.com/questions/18744910/using-jsf-as-view-technology-of-spring-mvc – Ced May 21 '15 at 18:27
  • Waht do you mean by this last comment? I fail to see the relation with your question (after a quick look) – Kukeltje May 22 '15 at 07:36
  • Btw I meant that if you do no use any spring stuff, why did you go for spring security and not shiro or (imo) even better, with picketlink – Kukeltje May 22 '15 at 07:38
  • This blog post may be helpful for you http://mprabhat.com/2012/09/23/integrating-spring-security-3-1-and-jsf-2-0/ – K. Siva Prasad Reddy May 22 '15 at 10:04
  • kukelje oh please if there is another better alternative I'm gonna take it. So I'll be going with picketlink. People advised me to use spring security. – Ced May 22 '15 at 11:01

0 Answers0