Questions tagged [spring]

62434 questions
1

votes
1

answer
7.2k

Views

Spring - Use applicationContext from .jar file added as a dependency

Imagine a situation where there are 2 independent modules - Module A and B. Both of them are constructed using Spring. Each of them have its own applicationContext - Module A works with applicationContextA and B - applicationContextB. Module A contains facade class - defined in a bean moduleAFacade...
user1949763
1

votes
2

answer
4.9k

Views

@ExceptionHandler with parameters not working

I am trying to capture all exceptions of some class in my Controller class. It works fine when I define it like this: @ExceptionHandler(NoSearchResultException.class) public String handleNoSearchResultException() { return "someView"; } But not if I add any parameters: @ExceptionHandler(NoSearchResu...
Gabriel Sanmartin
1

votes
1

answer
926

Views

Clone an existing ApplicationContext in Spring

I have a multi-threaded application I am trying to write with Spring, right now I am using the new thread scope declaration on my beans and passing the same context into the Runnable class. The threading works fine and I get a new copy of the DAO/Services for each thread so exactly how I want it. Th...
Clarence Liu
1

votes
2

answer
615

Views

Annotation value in advice

I want to access my annotation values in advice, my annotation can be placed on type or method. so far i am able to get the annotation value when applied on method but no success when the annotation is applied on type. @Before( value = "(@annotation(varun.mis.aspect.Logged) || within(@varun.mis.aspe...
varun
1

votes
2

answer
4.2k

Views

How do you use a bean from an another class in a class?

Using xml, I was able to define a common xml file, where i can put common bean which are used for other differect condig file. I move my config to psring java config, how to achieve this with java config? let's say I have my common class as : @Configuration public class Common { @Bean public A a(){...
storm_buster
0

votes
1

answer
8

Views

Getting kubernetes secret / env for authentication into java application

I hava a java spring.boot application that uses Kubernetes, I'we configured this .yaml file - name: ACTUATOR_USERNAME valueFrom: secretKeyRef: name: actuator key: username - name: ACTUATOR_PASSWORD valueFrom: secretKeyRef: name: actuator key: password added this attributes to my application.properti...
JonB
0

votes
0

answer
5

Views

Spring JPA Criteria API search in list of names by json list

I am trying to create JPA Specification that search in list by json list @Override public Predicate toPredicate(Root root, CriteriaQuery criteriaQuery, CriteriaBuilder builder) { Expression unitsNames = builder.function("json_array_elements", String.class, root.get("unitsNames")); return builder....
Mohamed Adel
1

votes
0

answer
9

Views

Spring JPA - sequence caching gives unexpected behaviour. Using allocation size = 1 is ok

My Spring Boot application uses a.o. 2 Entity classes. Entity class 1 uses a technical key id that uses a sequence. The Entity contains a list of other Entities, so a one-to-many. The Child entity uses the same sequence. Using a seqeuence allocation (cacheing) size of 20, I see that I get EntityExi...
johangeocache
1

votes
1

answer
10.4k

Views

spring hibernate optimistic locking issue

This is my Repository layer: class RepositoryImpl implements Repository{ @Override public Serializable saveOrUpdate(Object obj) { return getSession().save(obj); } @Override public Object get(Class refClass, Serializable key) { return getSession().get(refClass, key); } } This is my Service lay...
Prabhakaran
1

votes
1

answer
796

Views

Migrating Spring application from Postgres to Oracle: defining table's schema

FINAL EDIT The reason why I didn't see any logs is that I was using an old version of log4j. Hibernate hbm2ddl uses slf4j for logging and so all the logs were ignored by log4j 1. Now I upgraded to log4j2 that has a slf4j bridge and I see all the errors in the log. Godd new is that from here I can pi...
malavock
1

votes
3

answer
2.3k

Views

Issue with comparing two object in Hibernate

I have 2 methods. @Service @Transactional public class MyService { void myMethod() { Entity e1 = dao.get(1); e1.setName("NEW ENTITY NAME"); save(e1); } void save(Entity e) { Entity oldEntity = dao.get(1); oldEntity.getName().equals(e.getName()) // TRUE. Why? } } But in method save entities are not...
MyTitle
1

votes
3

answer
2k

Views

BCrypt check if already crypted?

My question is how can I check if a password is already crypted with Bcrypt.And if it is, let Bcrypt do nothing ,just leave the password like it is.I'm working with Java(EE),Spring. public static String hashPassword(String userPassword) { String bCrypt = null; if (userPassword == null) throw new Nul...
Sunay Hashimov
1

votes
1

answer
1k

Views

Java Spring/Maven LogFactory Error

I am trying to run JUnit on a Maven/Spring project and am testing with a web service client (axis2). Here is the buggy web service client calls: ProServiceLocator locator = new ProServiceLocator(); // CRASH proServiceEndpoint = locator.getProServicePort(); Here is the error: java.lang.ExceptionInIni...
Exegesis
1

votes
1

answer
956

Views

Unrecognized field “_links” since the 2.0.0.RC1 of Spring Data REST

On one side, I have just update the version of spring-data-rest-webmc to the latest 2.0.0.RC1 version of my server. In this version, the json format change to an HAL format. On the other side, I have a client which use the spring-hateoas library with the 0.9.0.RELEASE version. In this client, I use...
bwilcox
1

votes
1

answer
1.4k

Views

What is the default scope for bean in spring MVC?

I am working with SpringMVC .Every thing going good but I have some doubts 1)What is the default scope for SpringMVC 2)What is the differnce between @pathvarible,@RequestParam
user2963481
1

votes
1

answer
703

Views

add a serial number while performing iteration in thymeleaf

I have a senario in which i must perform iteration on a list and display result as a grid.Also include serial number in it. Now what I did for serial number is given below //other codes but only 1 appears in all serial number.Can anyone help me with this?
user2078883
0

votes
0

answer
24

Views

Spring RestTemplate make a multipart request

I've two microservices(built in spring-boot). Let's consider microservice A & microservice B. I want to make a proxy call of multipart form request. For that I'm using RestTemplate. But I'm getting the error org.springframework.web.client.HttpClientErrorException: 406 null. It's working properly if...
AshwinK
0

votes
0

answer
9

Views

Spring Batch - ClassifierCompositeItemWriter For Insert Or Update

I try to migrate data between databases The target : 1.Insert Data (New Data) or 2.Update (If data is exist) In itemProcessor, i use JDBC Template to find data in target database. After that data will marked as new/update. I read it possible to make itemWriter choose for Update or Inserting data fro...
relesa telco
0

votes
0

answer
3

Views

Ramdom com.rabbitmq.client.ShutdownSignalException: connection error

we have an application where we use Spring-AMQP to connect to a remote server through AMQP. Lately, and randomly, we are receiving connection errors. These errors occur once or twice a day at different times, and it is beginning to be a major problem. The trace that remains in the log is the follow...
jandres
0

votes
0

answer
6

Views

JPA Eclipselink query parse problem in windows 7

I have a standalone spring boot web service which uses eclipselink v2.7.3. I have query in NamedQuery inside my class. SELECT m , o.iduserinsert.id as iduserinsert FROM Mytable m, Order1 o WHERE o.idmytable=m and (o.id is null or o.idorderstatus.id in (1,3,4)) and m.iddepartment = :iddepartment...
rgaraisayev
2

votes
1

answer
11

Views

Getting UnsatisfiedDependencyException: while using JSF @Push-annotation with Spring frame work

Trying to Migrate from Primefaces PUSH to JSF Push(Websocket), While trying out JSF Push in Java project JSF Push works fine as expected. But when trying in Spring application I'm getting the below exception org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with n...
Anudeep
1

votes
2

answer
2.5k

Views

spring boot not launching static web content

Am trying to launch index.html in my spring boot app but see 404. What dependency am I missing? build.gradle (multi project) project('sub-project') { apply plugin: 'spring-boot' compile ( "org.springframework.boot:spring-boot-starter-web:1.0.0.RC5", "org.springframework.boot:spring-boot-starter-actu...
suman j
1

votes
1

answer
2.1k

Views

Spring Security - Anonymous Authentication - HttpSessionRequestCache

Please help me on this. void setCreateSessionAllowed(boolean createSessionAllowed) method of org.springframework.security.web.savedrequest.HttpSessionRequestCache class says If true, indicates that it is permitted to store the target URL and exception information in a new HttpSession (the defaul...
VirtualLogic
1

votes
2

answer
465

Views

jboss 7.1.1 webservices suddenly stopped working

I have a deployed and public app available where everything is working. The rest of the team is working on a new release and before releasing it, we started running tests at everything. Out of the blue, the web services that we use to communicate with a payment gateway stopped working and started re...
Tiago Ferreira
1

votes
1

answer
4.1k

Views

Hibernate findByExample with 'like'like behaviour on not null (string?) fields from the example

I'm using hibernate 4 and Spring 3. As the long title says, I need to create a method like this public list findByExample(MyObject exampleInstance){ Criteria crit = session.createCriteria(MyObject.class); Example example = Example.create(exampleInstance); crit.add(example); return crit.list(); } bu...
Gabber
1

votes
2

answer
1.2k

Views

Custom permission to custom portlet on specific user in liferay

How can i define custom permisssion to custom portlet for specific user in liferay I used enviroment liferay 6.1.2 ga3 with jboss In my custom portlet deploy/undeploy button but how can i give specific permission to that only admin person can access that function any other can not use that check th...
user3595542
1

votes
0

answer
68

Views

Spring Boot Application With Axis2 - /BOOT-INF/lib/addressing-1.6.2.mar file cannot be found

During SOAP call am getting a below exception, but in local am not getting any exceptions. I am really not sure why addressing-1.6.2.mar referring application jar path. Axis2 Structure: VM Arguments: JAVA_HOME=/apps/jdk/jdk1.8.0_111 ANTIFRAUD_HOME=/apps/Benefits/AntiFraud/r20/dev nohup $JAVA_HOME/bi...
Bharathiraja S
0

votes
0

answer
2

Views

Spring Batch giving All bytes to be written were not successfully written error

I have written a spring batch job that uses a flatFileItemWriter to write a huge amount of data to the file. The job is intermittently failing with the following error org.springframework.batch.support.transaction.FlushFailedException: Could not write to output buffer. I looked into the source code...
shobhit garg
1

votes
2

answer
3k

Views

Spring data mongodb aggregate function not working using 1.3.5-RELEASE of spring-data-mongodb

I have requirement to filter document in mongodb using spring data which contains nexted arrays of arrays. I am using following aggregation query on mongo shell and it is working fine. But when I am firing that through springdata aggregation operation, I am gettin empty response. Working mongo query...
Developer G
1

votes
1

answer
1.1k

Views

Singleton Not working in Spring Latest version

I tried to set singleton as false or true in the configuration xml file as below while validating it is throwing the below error cvc-complex-type.3.2.2: Attribute 'singleton' is not allowed to appear in element 'bean'. i am using spring version 4. Is there any other way to implement this property? T...
B.K
1

votes
2

answer
2.4k

Views

AnnotationConfigRegistry not found in spring 4

I am having an strange behavior, using spring 4.1.1 I get this error. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project newvalia-view: Compilation failure [ERROR] /C:/Users/edu/IdeaProjects/newvalia/newvalia- view/src/main/java/co...
duardito
1

votes
1

answer
3.7k

Views

An explanation about overriding SimpleUrlAuthenticationFailureHandler

I've been studying java and Spring for a while, during my spare time so I neither master java nor Spring yet. For the web project I created to study java and Spring I had to extends the SimpleUrlAuthenticationFailureHandlerm. What it's not clear to it's why after extending SimpleUrlAuthenticationFai...
MDP
1

votes
1

answer
1k

Views

@SessionAttributes and @ResponseBody do not work together

I have created a very simple "test" controller that keeps a counter in session to print how many times a request handler is called. @Controller @SessionAttributes("counter") public class MyController { @ModelAttribute("counter") public Counter addCounter(){ System.out.println("Counter added to mode...
fdm
1

votes
1

answer
6.5k

Views

How to read manifest.mf from *.war/META-INF/MANIFEST.MF file?

Using maven get compiled *.war file, which contains: - META-INF - - MANIFEST.MF - WEB-INF - - classes - - lib - - web.xml Using java.util.jar.Manifest I want to read the manifest file to get application version from there like in https://stackoverflow.com/a/21046257/1728511 But Application.class.get...
Mikhail Kopylov
1

votes
1

answer
1.5k

Views

get response from spring oauth2 token request as xml

I am implementing a oauth2 rest server using spring 4 and spring oauth2. Response can be either xml or json as specifeid by the client request header. But am getting issues from oauth2 when ever I try to access the token it supports only JSON (application/json), its not supporting xml(application/xm...
Pranav
1

votes
3

answer
3.6k

Views

PathMatchingResourcePatternResolver Cannot search for matching files underneath URL because it does not correspond to a directory in the file system

I am facing the error from subject and I have no idea where I can give a try. The most interesting thing is that the application is running perfectly. I searched in the internet and I found some similar topics from some OSGI users. Although I am not interested in using OSGI and I believe Spring 4 do...
de ca
3

votes
3

answer
144

Views

Select json column using JPA native query with MemSql

I have a table in a MemSql database which contains a column of type JSON. I am trying to execute the following query. select tweet from tweets_json; The tweet column is the JSON column. Here is the code I am using to execute this query. public List getTweets(){ Query q = entityManager.createNativ...
Fanooos
0

votes
0

answer
6

Views

Get method mapped to request in Spring Security

I have to use some custom role authorization logic with spring security and jaxrs. Meaning I want to use my custom annotation. I have a problem with obtaining the method and class that are mapped to the current request and I need them so I can extract the annotations present on them. I tried injecti...
randomname
1

votes
0

answer
10

Views

Sending Multipart/mixed request with boundaries

I am trying to create a multipart-mixed request with two sections:- application/x-url-form-encoded multipart/form-data Example Request:- POST http://sample:8080/api/documents HTTP/1.1 Accept: application/json Accept-Language: en API-Version: 2 Content-Type: multipart/mixed; boundary=19D523FB Host:...
leo_roar_001
1

votes
1

answer
211

Views

Infinte loop when bad credentials are entered in spring security/form login

As much as I have been able to determine it gets into infinite loop only when following bean is enabled on my . If this bean is enabled WebSecurityConfigurerAdapter extended class. @Override @Bean(name = "MyAuthManager") public AuthenticationManager authenticationManagerBean() throws Exception { re...
user871199

View additional questions