spring-java-config

quartz Fire Job immediately doesn't work

南楼画角 提交于 2019-12-06 04:50:09
I integrated quartz 2 and spring 4 with maven and java annotation ( using servlet 3 ), also i am using tomcat 7 maven plugin for deploying my project,my quartz Configuration class like as below : and my job class define simply like as below : then i use the quartz Scheduler for using fire my job trigger immediately as below : but my problem is : when i call fireNow methode with "job1" , "mygroup" parameters nothing happens and my job1 do not call immediately and don't print anything in console, i also track the db tables an i noticed after running the fireNow method new row inserted in my qrtz

@EnableJpaRepositories looking for which package?

让人想犯罪 __ 提交于 2019-12-05 21:44:00
I am learning how to build JSF and Spring integrated webapp. I am using java config to configure. The problem is @EnableJpaRepositories, which package should I put in this annotation? the package contains entity classes? or configuration class? or? and can I just put my root package into it and let it search by itself? EnableJpaRepositories - use only for repositories and not for entity or config. Main goal for this annotation is to find all repositories. you can configure jpa repositories in couple ways (dependent on package structure in your peoject), @EnableJpaRepositories -- in this case

StackOverflowError Trying to Expose AuthenticationManager in Spring WebSecurityConfigurerAdapter

℡╲_俬逩灬. 提交于 2019-12-05 19:47:09
I am attempting to create a Spring Security configuration by extending WebSecurityConfigurerAdapter basically like this: @EnableWebSecurity @Configuration public class StackOverflowSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(myUsernamePasswordProvider()); auth.authenticationProvider(mySecurityTokenProvider()); super.configure(auth); } @Override @Bean public AuthenticationManager authenticationManager() throws Exception { return super.authenticationManagerBean(); }

Can't get spring batch conditional flows working

北城余情 提交于 2019-12-05 12:15:30
I'm having trouble getting a conditional spring batch flow to work using java config. The samples I've seen in spring batch samples, or spring batch's test code, or on stack overflow tend to show a conditional where a single step needs to be executed on condition, or it's the final step, or both. That's not the case I need to solve. In procedural pseudo code, I want it to behave like initStep() if decision1() subflow1() middleStep() if decision2() subflow2() lastStep() So, subflow1 and 2 are conditional, but init, middle and last always execute. Here's my stripped down test case. In the

How do I add an Access Denied Handler in spring-security-javaconfig

青春壹個敷衍的年華 提交于 2019-12-05 11:19:03
问题 I'm using the spring-security-javaconfig library for spring security. If I were using xml config files, I'd use something like this to define a custom Access Denied page: <http auto-config="true"> <intercept-url pattern="/admin*" access="ROLE_ADMIN" /> <access-denied-handler ref="accessDeniedHandler"/> </http> Here is my security configuration class so far: @Configuration @EnableWebSecurity public class SecurityConfigurator extends WebSecurityConfigurerAdapter { @Override protected void

The annotation @EnableSpringDataWebSupport does not work with WebMvcConfigurationSupport?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 10:30:44
I had been using the WebMvcConfigurerAdapter for a while. Since i could not get all the registered interceptors with the method getInterceptors(), i have switched to WebMvcConfigurationSupport, which has lot of default registered Spring Beans like ContentNegotiationManager, ExceptionHandlerExceptionResolver usw. Now i have realised that, the very handy DomainClassConverter (which converts the domain class ids to domain class objects by using a CrudRepository) is not registered by default, although i use the annotation @EnableSpringDataWebSupport on my WebConfig class. When i define this bean

Code-based Spring Security Configuration

旧城冷巷雨未停 提交于 2019-12-05 04:16:07
I am trying to use Spring Security framework with a code-based configuration and I am following this tutorial. I have the following code in my initializer for the filter: FilterRegistration.Dynamic springSecurity = servletContext.addFilter("springSecurityFilterChain", new DelegatingFilterProxy()); springSecurity.addMappingForUrlPatterns(null,true,"/*"); I think this is correct but I don't know how to implement the spring-security.xml like a bean in the @Configuration class. Rob Winch Update There was a project that provided this: "Spring Security Java Config" . It was merged into spring

Spring Batch (java-config) executing step after a jobExeuctionDecider

淺唱寂寞╮ 提交于 2019-12-05 00:15:28
问题 I'm trying to configure a Flow in spring batch using java-config, this flow basically has to do this: Execute a init step(which adds a record in the database), then execute a decider to check file existence, 2.1. IF the files exists it will execute the load job (which is another flow with a bunch of steps in parallel) Execute a finish step (which adds a record in the database), this should always run, even if 2.1 was not executed. I tried to do this configuration, but the finish step never

Spring JPA EclipseLink config with java throws Cannot perform exception translation

社会主义新天地 提交于 2019-12-04 21:51:00
I am trying to config eclipselink with spring jpa in java not in XML. Here is my config file @Configuration @EnableJpaRepositories @EnableTransactionManagement class ApplicationConfig { @Bean public DataSource dataSource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName("com.mysql.jdbc.Driver"); dataSource.setUrl("jdbc:mysql://localhost:3306/trail"); dataSource.setUsername("user1"); dataSource.setPassword("password"); return dataSource; } @Bean public EntityManagerFactory entityManagerFactory() { EclipseLinkJpaVendorAdapter vendorAdapter = new

Converting spring xml to java configuration with implicit setter autowiring and ComponentScan

淺唱寂寞╮ 提交于 2019-12-04 21:13:08
I have two classes: vehicle.Tire and vehicle.Car. package vehicle; @Named public class Tire { private String age; } package vehicle; @Named public class Car { private Tire tire; // Spring calls this setter because default-autowire="byName" of xml configuration public void setTire(Tire newTire) { this.tire = newTire; } public Tire getTire() { return this.tire; } } The following spring xml works fine. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=