Tag: spring java config

Spring Security Java Config不生成logout url

我使用的是Spring 4.0.5.RELEASE和Spring Security 3.2.4 。 我正在尝试使用java配置创建一个简单的示例应用程序(基于Spring示例)。 应用程序启动并且身份validation正常运行,也就是说,在访问受保护的url / settings / profile时,我被重定向到登录表单 但是没有/ logout url生成? 如果我点击localhost:8080 / logout我得到404。 我在以前的项目中使用了类似的代码,所以可能与版本有关? inheritance我的安全配置 @Configuration @EnableWebMvcSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser(“user”).password(“password”).roles(“USER”); auth.inMemoryAuthentication().withUser(“admin”).password(“password”).roles(“ADMIN”); } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers(“/settings/**”).hasRole(“ROLE_ADMIN”) .and() .formLogin() .and() .logout() .deleteCookies(“remove”) .invalidateHttpSession(true) .logoutUrl(“/logout”) […]

使用Spring IoC和JavaConfig配置AspectJ方面?

根据Spring的文档使用Spring IoC配置AspectJ方面以配置Spring IOC的方面,必须在xml配置中添加以下内容: 正如@SotiriosDelimanolis所建议的那样,在JavaConfig中将以下内容重写为: @Bean public com.xyz.profiler.Profiler profiler() { com.xyz.profiler.Profiler profiler = com.xyz.profiler.Profiler.aspectOf(); profiler.setProfilingStrategy(jamonProfilingStrategy()); // assuming you have a corresponding @Bean method for that bean return profiler; } 但是,如果Profiler方面是用native aspectj .aj语法编写的,这似乎只能起作用。 如果它是用Java编写的并使用@Aspect注释,则会收到以下错误消息: 对于类型Profiler,方法aspectOf()未定义 对于使用@AspectJ语法编写的方面,是否有使用JavaConfig编写此方法的等效方法?

Spring Batch – 循环读取器/处理器/写入器步骤

回答 根据接受的答案代码,对该代码的以下调整对我有用: // helper method to create a split flow out of a List of steps private static Flow createParallelFlow(List steps) { SimpleAsyncTaskExecutor taskExecutor = new SimpleAsyncTaskExecutor(); taskExecutor.setConcurrencyLimit(steps.size()); Flow[] flows = new Flow[steps.size()]; for (int i = 0; i < steps.size(); i++) { flows[i] = new FlowBuilder(steps.get(i).getName()).start(steps.get(i)).build(); } return new FlowBuilder(“parallelStepsFlow”) .split(taskExecutor) .add(flows) .build(); } […]