spring-java-config

Spring MVC and AOP: @Pointcuts for @Controllers only works in Testing and not for Production

无人久伴 提交于 2019-12-11 03:09:23
问题 I am working with Spring Framework 4.3.3 in a Web Environment: I have two contexts: RootApplicationContext ServletApplicationContext I know the ServletApplicationContext contains all the beans about the web side, for example @Controller . Furthermore ServletApplicationContext is able to access all the context or beans from the RootApplicationContext for example @Service, @Repository etc. Until here I am fine. Note it applies for @Configuration classes too. (Infrastructure) Therefore with the

Spring WebApplicationInitializer not working in wildfly 8.2.0 EAR Deployment

馋奶兔 提交于 2019-12-11 02:57:43
问题 I have very simple EAR with one spring mvc web app (war), all spring libraries are in myear.ear/lib folder. I'm not using web.xml instead i'm trying to use WebApplicationInitializer but Wildfly server is not detecting this and i'm getting 404 page. But if i have spring-mvc libs inside WEB-INF/lib then its working. Even I have put debug pointer at my WebApplicationInitializer implementation but it doesn't seem calling the onStartup method itself (and No error logged). Has anybody faced the

Error creating bean with name 'securityConfig': Injection of autowired dependencies failed

夙愿已清 提交于 2019-12-11 01:27:26
问题 I am trying to combine Java-config and xml-config for spring security authentication. But i received an error: Error creating bean with name 'securityConfig': Injection of autowired dependencies failed What seems to be the problem with my code? Been googling for answers but have not found any. Thanks in advance. hope you can help me. Stack-trace: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityConfig': Injection of autowired dependencies failed;

HTTP 405 Method Not Allowed

寵の児 提交于 2019-12-10 23:55:55
问题 I'm wondering why my code doesn't work at random when I try to login but when I close the browser and recompile the code,it will work like normal. The error usually come when I logout after successfully login, then when I try to re login this error come out in chrome: Request method 'POST' not supported When I try to open in IE,this come Out: (HTTP 405 Method Not Allowed) in console error: org.springframework.web.servlet.PageNotFound - Request method 'POST' not supported org.springframework

Spring xml config enable @Async without @Scheduled

亡梦爱人 提交于 2019-12-10 21:22:11
问题 Using Spring's xml configuration, how can I enable scanning of @Async annotations without also enabling scanning of @Scheduled annotations? Normally, you would enable both simultaneously using <task:annotation-driven /> but I'm trying to enable scheduling only when a particular Spring profile is active. Using Spring JavaConfig, you can use @EnableAsync and @EnableScheduling separately. I'm maintaining a project that's been around for a few years and uses only xml and annotation based config

Multiple ThreadPoolTaskExecuters Spring Java Config

荒凉一梦 提交于 2019-12-10 18:22:16
问题 I have a need for multiple tasks executors in my application but I am not seeing how do so with Java Config. The XML version is straight forward but I must be missing something with the Java Config I need two different executors with different queue and thread pool sizes, how can this be done using Java Config? Here is my AsyncConfig class import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;

Spring Javaconfig based autowire by name not working

久未见 提交于 2019-12-10 17:07:12
问题 I am trying to use Javaconfig based Spring configurations. I have two beans of same type and trying to autowire them by Qualifier. But it does not seems to working. This is my Configuration class @Configuration @EnableAutoConfiguration @ComponentScan("com.test") public class BasicConfig { @Bean(name = "mysqlSource") @Qualifier("mysqlSource") public DataSource jdbcTemplateMySql() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName("com.mysql.jdbc.Driver");

spring security oauth2 java config - Handler dispatch failed; nested exception is java.lang.StackOverflowError

独自空忆成欢 提交于 2019-12-10 15:36:56
问题 Configured Spring Security with OAuth2 in java config, And client_credentails flow is working fine, but password flow is throwing Handler dispatch failed; nested exception is java.lang.StackOverflowError below is the log information 2016-10-10 23:19:08 DEBUG o.s.w.s.m.m.a.ExceptionHandlerExceptionResolver - Resolving exception from handler [public org.springframework.http.ResponseEntity<org.springframework.security.oauth2.common.OAuth2AccessToken> org.springframework.security.oauth2.provider

Should I annotate configuration class as @Configuration for testing?

那年仲夏 提交于 2019-12-10 15:22:05
问题 I spent some time resolving problem with missing org.joda.time.DateTime->java.util.Date converter in Spring Data (which should be enabled by default when Joda-Time is on a classpath). I have found a reason, but it generated a question about @Configuration annotation in Spring. Standard application config using AbstractMongoConfiguration from spring-data-mongodb: @Configuration @ComponentScan @EnableMongoRepositories public class AppConfig extends AbstractMongoConfiguration { ... } A test

How can I qualify an autowired setter that I don't “own”

 ̄綄美尐妖づ 提交于 2019-12-10 02:21:34
问题 The gist is that the Spring Batch (v2) test framework has JobLauncherTestUtils.setJob with an @Autowired annotation. Our test suite has multiple Job class providers. Since this class is not something I can modify, I'm not sure how I can qualify which job it gets autowired with, which may be different per test. STDOUT [WARN ] [2015.04.15 11:14:42] support.GenericApplicationContext - Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans