Questions tagged [spring-4]

Version 4.x of the Spring Framework

Use for general Spring related questions. This tag is for questions that are specific to versions 4.x only.

618 questions
3
votes
1 answer

How to get all the requestmapping of all controllers?

I created many controllers having each their requestmapping specified in order for them to be identified in the app : package com.ambre.hib.controller; @Controller @RequestMapping("/") public class HomeController { ... } package…
pheromix
  • 18,213
  • 29
  • 88
  • 158
3
votes
0 answers

Failure with Spring 4 + Java 8 when executing JUnit 4 test: Failed to read candidate component class

I'm facing a problem which I can't solve after doing some research around: When I run my JUnit4 test, I get error: ERROR: org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener …
Enyix Mexico
  • 63
  • 1
  • 7
3
votes
1 answer

java.lang.IllegalStateException: Failed to load ApplicationContext in JUNIT

I am facing problem with JUnit while running unit test cases.I am using Spring 4 and JUnit 4. I didn't know why i am getting this exception while running the test code.I tried all the possible ways to execute the code but i got failed to run test…
Nagendra V
  • 137
  • 2
  • 3
  • 13
3
votes
1 answer

Deployed Simple HelloWorld with Spring MVC app (without web.xml) gives 404 error

I am newbie to Spring MVC with annotations, I have worked with Spring MVC XML Configuration earlier. I get 404 error when I try to hit the url http://localhost:8080/HelloWorldApp. I have written three classes: 1. AppIntializer 2. AppConfig 3.…
Harleen
  • 773
  • 3
  • 15
  • 25
3
votes
2 answers

Spring Boot Remove Whitelabel Error Page for web application

I have a spring boot web application,which I am deploying as a war file in tomcat. I do not want the user to be displyed the white-label error page. I have progressed a bit on this, but need to re-direct the same to error page. The below code is…
Manu
  • 1,379
  • 6
  • 24
  • 53
3
votes
1 answer

java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanException

I am building a JAX-WS web service in Java 8 and using Spring 4.2.6 and Hibernate 5.1 with it. But when I am deploying my project on tomcat, I am encountering following exception. I have googled the same and none of the stackoverflow post has been…
Steve
  • 889
  • 1
  • 12
  • 26
3
votes
2 answers

Websphere problems when setting up Http Connection Pool for RestTemplate

I'm working with Spring 4.0.3.RELEASE version. I'm able to make restful calls successfully. However, I learnt that HTTP connections are expensive and thought of using connection pool. I read few articles like this and this. Everything is fine when I…
3
votes
0 answers

Spring 4 how to dynamically register new beans during runtime without refreshing application context?

I have a spring application that has run into some issues while upgrading from Spring 3.2 to Spring 4.2. The application has standard XML based bean configuration that it loads into the application context, but also during runtime used a…
Adam Bronfin
  • 1,209
  • 3
  • 27
  • 43
3
votes
0 answers

Autowire instance variables based on parent Qualifier

Can Spring autowire variables of a class based on the Qualifier which was used to autowire the class enclosing those variables? Say, I have a common ToolsSet class public class ToolsSet { @AutoWired Drill drill; @AutoWired Hammer…
Rnet
  • 4,796
  • 9
  • 47
  • 83
3
votes
1 answer

Spring 4 recommended replacement of JpaTemplate

I have a legacy project which was using Spring 3.0.x and made use of the JpaTemplate implementation provided by Spring. However, after upgrading to Spring 4.0.x I learned that JpaTemplate was deprecated as of Spring 3.2 I have seen suggestions to…
Adam Bronfin
  • 1,209
  • 3
  • 27
  • 43
3
votes
0 answers

Does anyone know how to test EventListeners in spring?

I am looking into the spring domain event features in spring 4.2 and it looks really greate. it is however, a bit messy to test. Given the following business logic : public DomainEvent CreateOrder(Order order) throws OrderRejectedException…
3
votes
1 answer

Beancreationexception+NosuchBeandefinition exception

I am working on Spring 4 application with SpringBoot. In com.test.tm package, Application class: @SpringBootApplication @EnableJpaRepositories( repositoryFactoryBeanClass = GenericRepositoryFactoryBean.class ) @Import( {…
Abhishek
  • 1,999
  • 5
  • 26
  • 52
3
votes
1 answer

No AuthenticationProvider found for org.springframework.security.authentication.UsernamePasswordAuthenticationToken

I am very new to spring 4.0. I am getting error "No AuthenticationProvider found for org.springframework.security.authentication.UsernamePasswordAuthenticationToken" while login attempt Here are the files ApplicationConfig Class package…
krishna Ram
  • 639
  • 3
  • 9
  • 20
3
votes
0 answers

Spring 4 - Add a custom filter before BasicAuthenticationFilter, but only for certain URL patterns

I'm using Spring/Security 4.x with Java configuration. I have several URLs. All of them are authenticated using BASIC authentication. Assume URL patterns are, /urlPattern1/** /urlPattern2/** /urlPattern3/** Everything works fine so far. Now I…
sura2k
  • 7,365
  • 13
  • 61
  • 80
3
votes
2 answers

How to Autowire generic class using Spring 4?

I have class like below : class Foo { private Producer kafkaProducer; public Foo() { this.kafkaProducer = new Producer(new ProducerConfig()); } } There is another DAO…
Shekhar
  • 11,438
  • 36
  • 130
  • 186