小编Adr*_*pez的帖子

使用Gradle(JetGradle)和Intellij Idea 13提供依赖关系

我有一个多项目构建,其中包含多个依赖于一个jar模块的war模块.

war和jar模块都依赖于Spring,Hibernate等库,这些依赖项在war模块上定义为provideCompile,在jar上定义为compile.

问题是当JetGradle更新依赖关系时,所有工件都有错误,因为工件需要jar模块的依赖关系.

我想使用以下任何一种解决方案:

  1. 将库包含在服务器的lib文件夹中,让Intellij按照提供的方式处理它们.
  2. 以某种方式将库包含在项目范围库中,因此即使在更新了gradle依赖项之后,intellij也会将它们放在所有工件上.

另一方面,从一开始我的方法就完全错了.

war模块中的依赖关系定义为:

providedCompile 'org.slf4j:slf4j-log4j12:1.7.5'
providedCompile 'org.slf4j:jcl-over-slf4j:1.7.5'
...
compile(project(':jarModule')) {transitive = false}
...
Run Code Online (Sandbox Code Playgroud)

jar模块中的依赖项定义为:

...
compile 'org.slf4j:slf4j-log4j12:1.7.5'
compile 'org.slf4j:jcl-over-slf4j:1.7.5'
...
Run Code Online (Sandbox Code Playgroud)

intellij-idea gradle

11
推荐指数
1
解决办法
6665
查看次数

使用Spring安全性Javaconfig进行基本和基于表单的身份验证

我正在尝试为不同的url模式定义两种不同的安全配置,其中一种使用表单登录,另一种使用api的基本身份验证.

我正在寻找的解决方案类似于这里解释的解决方案http://meera-subbarao.blogspot.co.uk/2010/11/spring-security-combining-basic-and.html但我想这样做使用java配置.

提前致谢.

这是我目前的配置:

@Configuration
@EnableWebSecurity
public class AppSecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private UserService userService;

    @Override
    protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
        auth.userDetailsService(userService);
    }

    @Override
    public void configure(WebSecurity web) throws Exception {
        // Ignore any request that starts with "/resources/".
        web.ignoring().antMatchers("/resources/**");
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeUrls().antMatchers("/", "/index", "/user/**", "/about").permitAll()
        .antMatchers("/admin/**").hasRole("ADMIN")
        .anyRequest().authenticated()
        .and().formLogin()
        .loginUrl("/login")
        .failureUrl("/login-error")
        .loginProcessingUrl("/security_check")
        .usernameParameter("j_username").passwordParameter("j_password")
        .permitAll();

        http.logout().logoutUrl("/logout");
        http.rememberMe().rememberMeServices(rememberMeServices()).key("password");
    }

    @Bean
    public RememberMeServices rememberMeServices() {
        TokenBasedRememberMeServices rememberMeServices = new TokenBasedRememberMeServices("password", userService); …
Run Code Online (Sandbox Code Playgroud)

java spring spring-security

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

gradle ×1

intellij-idea ×1

java ×1

spring ×1

spring-security ×1