spring-java-config

Spring 4 Java Config for MultipartResolver for Servlet 3.0

二次信任 提交于 2019-12-09 05:53:05
问题 I'm taking an all-Java approach to Spring MVC configuration and cannot figure out how to associate a MultipartConfigElement with my DispatcherServlet programmatically. Spring documentation states: In order to use Servlet 3.0 based multipart parsing, you need to mark the DispatcherServlet with a "multipart-config" section in web.xml, or with a javax.servlet.MultipartConfigElement in programmatic Servlet registration... http://docs.spring.io/spring/docs/4.0.4.RELEASE/spring-framework-reference

Configuring Spring Wicket using Java Conf instead of xml

旧时模样 提交于 2019-12-08 11:08:43
问题 I'use Spring for a short time, but to wicket I am newbie. But I would like to give a try to this framework. I would like to configure this both frameworks togheter. But I would like to avoid usage of xml configuration file. I know that wicket can be configured that way, according to this: http://wicket.apache.org/guide/guide/single.html#helloWorld_2 and this: https://github.com/bitstorm/Wicket-tutorial-examples/tree/master/SpringInjectionExample But for now I am getting only errors: lis 15,

SpringBatch - javaconfig vs xml

家住魔仙堡 提交于 2019-12-08 02:29:43
问题 I have been using Xml configuration for Spring Batch for a while, and feel it is simpler and concise. However, nowadays, people are suggesting to use javaconfig over xml. I googled this topic. This site tells us why javaconfig is better https://blog.codecentric.de/en/2013/06/spring-batch-2-2-javaconfig-part-1-a-comparison-to-xml/ Top reasons to choose javaconfig over xml : We want to do some basic configurations in the framework. People add a dependency to our framework library and import

StackOverflowError Trying to Expose AuthenticationManager in Spring WebSecurityConfigurerAdapter

三世轮回 提交于 2019-12-07 16:59:25
问题 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

Can't get spring batch conditional flows working

社会主义新天地 提交于 2019-12-07 09:46:40
问题 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

The annotation @EnableSpringDataWebSupport does not work with WebMvcConfigurationSupport?

纵饮孤独 提交于 2019-12-07 06:20:06
问题 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,

Providing way to configure spring security?

旧时模样 提交于 2019-12-07 01:26:22
问题 Is it possible to configure spring security in a way that it reads configuration details from external file and configures accordingly. (I am not taking about changing config at runtime. I am talking about reading from a file at the time of startup) An example of my existing Sporing security config is: @EnableWebSecurity @Configuration public class SecurityConfig { @Bean public UserDetailsService userDetailsService() throws Exception { InMemoryUserDetailsManager manager = new

Code-based Spring Security Configuration

烂漫一生 提交于 2019-12-07 00:59:11
问题 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. 回答1: Update There

Spring JPA EclipseLink config with java throws Cannot perform exception translation

穿精又带淫゛_ 提交于 2019-12-06 16:46:27
问题 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

Annotation/java config based application starts to look for xml config file when moved from weblogic12c(12.1.3) to weblogic12cR2 (12.2.1)

寵の児 提交于 2019-12-06 05:35:37
问题 My spring java-config application packed as war runs wihout problem on weblogic 12.1.3 so I tried to deploy same war into weblogic 12.2.1 where it causes java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/DispatcherServlet-servlet.xml] . It seems like DispatcherServlet servlet is initialized with XmlWebApplicationContext (default one) instead of AnnotationConfigEmbeddedWebApplicationContext in 12.2.1 even when war is the same. Has someone any idea what was changed