Questions tagged [spring-annotations]

A common placeholder for issues related to the use of annotations with the Spring framework

The Spring Framework () provides several annotation-driven configuration options from wiring beans to managing transaction.

Annotation types

JSR support

  • JSR 107
    • @CacheResult
    • @CachePut
    • @CacheRemove
    • @CacheRemoveAll
    • @CacheDefaults
    • @CacheKey
    • @CacheValue
  • JSR 250:
    • @Resource
  • JSR 303:
    • @Valid
    • @NotNull
    • @Size, etc
  • JSR 330:
    • @Inject
    • @Named

Useful links

1301 questions
0
votes
1 answer

Java Spring Customized Annotation Variable Instantiation Issue

I ran into a situation whereas I defined a customize annotation class (SeleniumTest.java), and use that annotation in another class(AppSeleniumTest.java). However, I need pass in a constructor parameter to one of the @Autowired field…
MG.
  • 449
  • 6
  • 15
0
votes
1 answer

Spring security @EnableWebSecurity Error creating bean with name 'objectPostProcessor'

Im using spring security annotations to secure my Spring MVC application. After adding annotation @EnableWebSecurity I have got stacktrace like this : StackTrace : http://pastebin.com/szigdd69 My source codes: WebAppInitializer.class public class…
0
votes
1 answer

Spring AOP - Unable to execute Aspect

I am new to Spring AOP and annotations. I tried to write a simple program that uses Aspect. I am unable to figure out where I went wrong. Its doesn't print the what I have in my Aspect. package com.business.main; import…
karthik
  • 773
  • 2
  • 11
  • 19
0
votes
2 answers

Setting default DateTimeFormat Annotation in Spring

I know that a DateTimeFormat annotation can be defined on Date properties of a Model class in Spring but is there any way of defining a default dateTimeFormat annotation for all Dates in Spring Model classes? @DateTimeFormat(pattern =…
Fawad Shah
  • 1,680
  • 4
  • 15
  • 21
0
votes
0 answers

@Autowired with @Qualifier doesn't work

I have problem with @Autowired and @Qualifier annotations. I want to create object of this class: public class DatabaseUtils { private String driver, url, username, password; public void setDriver(String driver) { this.driver = driver; } public…
user3568916
0
votes
0 answers

Java planner integration to spring full annotation project not working

I'm working on a projet where I need to add an event calendar. I chose DHTMLX javaplanner to do that. here's what I have done: HIRBERNATE CONFIGURATION CLASS: @Configuration @EnableTransactionManagement @ComponentScan({ "com.XXX"…
0
votes
0 answers

Alternative to forward slash spring

I need to create and capture the path using spring dynamic paths as following: http://myHost/event/my/dynamic/path In other words, I need capture whatever it comes after event. The path after event is dynamic. This means, I don't know neither what…
ender.an27
  • 703
  • 1
  • 13
  • 35
0
votes
0 answers

How to implement Factory pattern using @Component and ServiceLocatorFactory without context xml in Spring

Am new to Spring. Followed online resources and implemented factory pattern without @Component annotation using ServiceLocatoryFactory, it is working fine. But how to implement annotation(without context xml) based factory pattern by using…
Hareesh Kumar
  • 63
  • 2
  • 8
0
votes
1 answer

Multiple Data source in hibernate annotation throwing No Session found for current thread error

I am using spring 4 & hibernate annotation in my web app. Everything works fine with single datasource. When I add second datasource I am getting No session for current thread error. Here is the code. public abstract class PortalAbstractDao
Rajeshkumar
  • 815
  • 12
  • 35
0
votes
1 answer

@Inject annotation for interface property getting null value in junit

I am using @Inject annotation for injecting interface(IFMJobHandler is an interface) in my class like this @Inject @Reference IFMJobHandler jobHandler; While running application with JUnit test, jobHandler property returning null value because of…
0
votes
3 answers

sessionfactory always null when done with javaconfig

The sessionFactory Bean which is autowired in my DAO is always showingup to be null. below is my project. import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; import org.springframework.context.annotation.Bean; …
0
votes
1 answer

Error while initialising SolrRepository: Unsatisfied dependency expressed through field

Here is the code which is gave me the below exception: @SpringBootApplication @ComponentScan(basePackages = { "com.ns.services.search", "com.ns.services.commons.exceptions" }) @EnableSolrRepositories(value = "com.ns.services.search",…
0
votes
1 answer

Does spring-boot-configuration-processor process annotated bean methods?

Does spring-boot-configuration-processor process annotated bean methods? Because in my case, it doesn't. Here is my code: @Data public class DatasourceConnectionPoolProperties { private Integer initialSize; private Integer maxIdle; private…
Vsevolod Poletaev
  • 1,482
  • 1
  • 12
  • 13
0
votes
4 answers

cannot retrieve properties using spring

edit note : during debug, autowired config object in the main class always returned null I am trying to build a simple spring application with a Configuration class and a main class which basically gets values from an external application.properties…
emrahozkan
  • 193
  • 1
  • 3
  • 15
0
votes
1 answer

how to inject the multiple bean in to single referenced variable dynamically using spring annotation

I have interface A.java and 3 classes which are implementing A.java interface named B.java, C.java and D.java. Now i am try to inject the bean like this. interface A{} @Component @Scope("request") class B implements A{ …
vinny
  • 1
  • 1