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

@Autowire in a java servlet using AbstractAnnotationConfigDispatcherServletInitializer

I am currently trying to use the new Java based annotation configuration for both spring and my Java Web Servlets. I am currently having an issue using the @Autowired annotation inside the servlet itself, but I am unsure if it is my configuration…
0
votes
1 answer

SPRING WEB MVC ANNOTATIONS-Method for Partial Page Rendering

Hello Friends, [Need some help regarding spring web mvc annotation based:] How to use partial page rendering on spring web mvc annotations. Master Page Name: CreateEntity.jsp Partial jsp page: Account.jsp, Lead.jsp etc etc* Now, this master page…
0
votes
0 answers

Mapping MapOf - UserDefinedType to POJO in cassandra using Spring Data Cassandra

I have the following user defined type in cassandra: CREATE TYPE key( name text, created_time timestamp ); It goes in the following table: CREATE TABLE keys( id uuid, keys map>> ); ** Note that the below…
0
votes
0 answers

Autowiring not working when used inside a java config bean

I am working on an existing webapp where most of the beans are defined and discovered using xml config. There are a bunch of xml files defined and included in the contextConfigLocation param of the web.xml, thus creating the web-application…
Abhijith Madhav
  • 2,748
  • 5
  • 33
  • 44
0
votes
1 answer

How could convert/implement spring aop function by annotation

I want to log time spent to log file when invoke some service methods , now I implement it by AOP, e.g. @Around("execution(* sample..TaskService.*(..))") public Object aroundStat(ProceedingJoinPoint joinPoint) throws Throwable { long start =…
zhuguowei
  • 8,401
  • 16
  • 70
  • 106
0
votes
0 answers

understanding BeanNameViewResolver in spring mvc with proper example

I am new to spring, i want to know about BeanNameViewResolver in spring mvc. I have tried one example by .That example is not working. i am unable to understand the problem. the problem is my request is not given to controller. source…
user7059863
  • 61
  • 2
  • 13
0
votes
1 answer

Ordering evaluation of Conditional annotations in spring

I have three classes all of which needs to be enabled/disabled based on the @ConditionalOnExpression annotaion. All of these are in separate .java files. EX: @ConditionalOnExpression("#T(com.xxx.xxx.xxx.xxx.CxProperties).isAEnabled()}") Class…
0
votes
1 answer

ModelAttribute in abstract class with value from subclass

I want to have a common method annoted @ModelAttribute in an abstract class but with value from subclasses. The final goal is to retrieve the value of a variable in JSP. The value is different in each subclass controller but I don't want to…
BasicCoder
  • 1,661
  • 10
  • 27
  • 42
0
votes
0 answers

How to configure ordering for Spring Configuration Classes

I am trying to have 2 configuration files. say ConfigA and ConfigB. I want Config B to be called first where it is calling ConfigA all time which is causing me some depenedency issues. I tried @DependsOn @Order @Import but nothing seems to be…
Shafs Jan
  • 400
  • 1
  • 3
  • 13
0
votes
1 answer

Spring: migrate XML config to Annotation for util:map

I have the below Spring configuration in an XML file: is there a way to migrate this to Annotation based…
hamid
  • 2,033
  • 4
  • 22
  • 42
0
votes
0 answers

Spring PointCut Annotation method call is called after the Actual business method

We are using Spring AOP pointCutAdvice with the AnnotationMatchingPointcut. sometimes, the actual method is called before the PointCutAdvice is called. And later again the same Actual method is called (totally twice). Are there any chances of…
murthy
  • 202
  • 5
  • 13
0
votes
1 answer

PollableChannel with Spring Integration

I have an interface Channels.java final String OUTPUT = "output"; final String INPUT = "input"; @Output(OUTPUT) MessageChannel output(); @BridgeFrom(OUTPUT) PollableChannel input(); I have another class where i perform…
0
votes
1 answer

Spring Data Rest Left Outer Join non-Entity POJO Null Entity Error

How do i accomplish getting the this interface method to work? i am using a MySQL DB if that matters... public interface PersonRoleRepository extends CrudRepository{ //This causes null entity error from hibernate even though the…
user2052618
  • 556
  • 2
  • 7
  • 20
0
votes
1 answer

Cron expression must consist of 6 fields(found 1 in "${cron.expression}) partially fixed but having issues with AnnotationConfigApplicationContext

I am trying to parameterize cron expression and reading it from properties file. During this process I get following exception "Error creating bean with name 'springScheduleCronExample': Initialization of bean failed; nested exception is…
Hemal
  • 51
  • 1
  • 1
  • 5
0
votes
1 answer

spring - use beans from config.xml in SpringConfig.class

I have some context that changes from deployment to deployment, and some that is constant for all deployments. The deployment-dependent bit is in an config.xml file that is external to the jar or war. The static context stuff is in an annotation…
scorpdaddy
  • 303
  • 3
  • 14