w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
  Home » SPRING » Page 1
SAML SSO: Can one SP metadata file be used for 5 separate SPs running the same application
As long as the applications are on different URLs you should use separate metadata for each. You could use a trick and configure each of the applications using SAMLContextProviderLP with a fictional scheme, host and port (i.e. pretend that all 5 applications are using the same public URL). But this would imply that same assertions from the IDP could be used to login to any of those 5 applications

Categories : Spring

SaxParseException when trying to set security="none" in URL interceptor
Try it with filters="none" instead of security="none". <sec:intercept-url pattern="/notimportant/url**" filters="none" /> This is deprecated in Spring 3.1, though, so you can try this <sec:http pattern="/notimportant/url**" security="none"/> Check out the documentation for more details.

Categories : Spring

Way to deserialize the byte array in spring java
I have decoded the byte array using .decodeBase64(byte[]) instead of .decodeBase64(String) Reason : Because the method .decodeBase64(final String base64String) is used in common-codec-1.4 version but I am using common-codec-1.9 version , hence I put .decodeBase64(byte[]) class DecodePhoto extends JsonDeserializer { @Override public byte[] deserialize(JsonParser jsonparser, Deserializ

Categories : Spring

Spring-ws SoapHeader fields access in endpoint method
A hacky way of getting the value from interceptor to the handleMethodRequest is using a static ThreadLocal instance. Since the same thread that invokes the interceptor also invokes the handleMethodRequest you can use ThreadLocal.set(AuthToken); // in interceptor. ThreadLocal.get();// in handler and then clear it after use. Also, I noticed that @SoapHeader(value = "{authToken") in your example

Categories : Spring

spring integration router unresolved channel id
Yes, you are right. There is no such an info in the related code. It looks only like this (AbstractMessageRouter): else { throw new MessageDeliveryException(message, "no channel resolved by router and no default output channel defined"); } Where something similar from MessageFilter is: if (this.throwExceptionOnRejection) { throw new MessageRejectedException(message, "MessageFil

Categories : Spring

deleting Child and Parent Entities on Spring MVC makes ConstraintViolationException
From the error it seems your tables work the other way around. I see a PROJECT_LISTARESPOSTAS referencing the PROJECT. Try deleting with opposite order: respostas.deleteAll(); Projects.deleteAll(); you may also want to check the delete cascade option so that when deleting an entity, reference entities are deleted too. That could be as simple as putting an annotation @OnDelete(action = OnDeleteA

Categories : Spring

Avoid IntelliJ to auto create @Qualifier annotation
Does someone know if there is the possibility to let IntelliJ stop writing @Qualifier annotation? The short answer is you can't. The @Autowire Dependency code generation action does not use an editable File Template. The long answer is you can prevent it from being inserted... IDEA will only insert that if there is no ambiguity as to the bean being used. For example, if I have one and only o

Categories : Spring

How to initialise/wire beans in Grails Spock unit tests?
You must be mocking the myBean as below def myBean = Mock(MyBean) or MyBean myBean = Mock() and then stub out method for your need if required as below: myBean.show >> "test data" and then assign it to controller object which is already mocked for you. controller.myBean = myBean and there you go. Or optionally you can stub out myBean and give stubbed implementations. For exampl

Categories : Spring

Spring Boot app work as standalone but not when Deploy in tomcat 7.X it doesn't work
For me solution was to update to Tomcat 8. Although http://spring.io/guides/gs/convert-jar-to-war-maven/ says that any servlet container of version 3.0 will do and http://tomcat.apache.org/whichversion.html says that Tomcat version 7 supports it I was unable to launch my war app on it. But upgrade to Tomcat 8 solved the issue.

Categories : Spring

Retrieve data where corresponding mapping is not found in one-to-many mapped field
This is how your query should look like: Criteria c = session.createCriteria(Forms.class, "frm"); c.createAlias("frm.responses", "res", CriteriaSpecification.LEFT_JOIN); c.createAlias("res.onBehalfOf", "beh", CriteriaSpecification.LEFT_JOIN, Restrictions.eq("beh.userID", userID)); c.add(Restrictions.isNull("beh.userID")); return c.list();

Categories : Spring

How to make flexible database for Spring MVC project
Use schemaless database, for example MongoDB. With Spring Data MongoDB you can persist maps that will give you flexibility you need: @Document public class Customer{ @Id private ObjectId id; private Map<String, String> properties; ... } Even though it is doable, I am not convinced if your design is valid. You can persist custom attributes in DB, but showing them in G

Categories : Spring

Whether Replication Possible With Spring Data Couchbase?
Using elastic search in Couchbase is not dependent on what you client application looks like or whether or not it uses Spring. As long as you are storing data in Couchbase in JSON format things should work fine. Setting up elastic search is more of an operations task than a development task. Take a look at the instructions at the link below and then run you application code as is. If you have con

Categories : Spring

java.lang.IllegalStateException: A SockJsMessageCodec is required but not available:
Hello Everyone I Found A Solution to my Problem... I just added two jar files. jackson-annotations-2.4.3.jar jackson-core-2.4.3.jar and it is now working... Opening Web Socket... stomp.js:145 Web Socket Opened... stomp.js:145 >>> CONNECT accept-version:1.1,1.0 heart-beat:10000,10000 stomp.js:145 <<< CONNECTED version:1.1 heart-beat:0,0

Categories : Spring

spring application Could not load JDBC driver class :oracle.jdbc.driver.OracleDriver
Add this jdbc-oracle.jar file into your project... jdbc-oracle.jar is available in http://www.java2s.com/Code/Jar/j/Downloadjdbcoraclejar.htm

Categories : Spring

Spring Batch - Read one record Write multiple records in multi threaded step
You can use Partitioner based on the process_id(first get all the unique processIds and inside Your custom Partitioner) and fire mutliple queries( Though most DBA's don't agree for this and may run out tempspace at db ) in reader Here is a prototype <batch:step id="step1.slave"> <batch:tasklet> <batch:chunk reader="jdbcCursorItemReader" writer="csvItemWriter" commit-in

Categories : Spring

Spring Batch Integration - Multiple files as single Message
Even if it is a single poll, the inbound-channel-adapter emits messages for each entry. So, to collect them to the single message you need to use an <aggregator>. Although with that you have to come up with ReleaseStrategy. Even if you can just use 1 as a correlationKey, there is some issue with releasing the group. You should agree with that you don't always have 1000 of files there to

Categories : Spring

Spring @Transactional(isolation=Isolation.READ_UNCOMMITTED) vs Spring Data @Lock(LockModeType.None)
Locking and Transaction are two different things, but anyway... This isolation level allows dirty reads. One transaction may see uncommitted changes made by some other transaction. /** * A constant indicating that dirty reads, non-repeatable reads and phantom reads * can occur. This level allows a row changed by one transaction to be read by * another transaction before any changes in that ro

Categories : Spring

Own SpringSecurity UserDetailsService dont load User - Could not obtain transaction-synchronized Session for current thread
you need to enable transaction management support. In the guide you followed it was done with @EnableTransactionManagement annotation over AppConfig class. In your case you use xml configuration, so you should add <tx:annotation-driven transaction-manager="txManager" /> inside your spring-config.xml

Categories : Spring

Spring Jms @JmsListener annotation doesnt work
Just tested your config and it works well. Only difference that I make a class with @JmsListener as a <bean> in that context: <bean class="org.springframework.integration.jms.JmsListenerAnnotationTests$TestService"/> @ContextConfiguration @RunWith(SpringJUnit4ClassRunner.class) @DirtiesContext public class JmsListenerAnnotationTests { @Autowired private JmsTemplate jmsTem

Categories : Spring

Spring 4 Rest problems
Include this in your Pom: <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${org.springframework.version}</version> </dependency> And let me know how you go.

Categories : Spring

what could cause 'Read timed out' in spring redis after only a couple reads?
From point of view of redis, this is highly unlikely occasion. So you most likely have mistakes in your Spring or Redis configurations. For example I can assume, that you specified timeout in redis configuration http://redis.io/topics/clients By default recent versions of Redis don't close the connection with the client if the client is idle for many seconds: the connection will remain op

Categories : Spring

fields are set to null in model if not bound to spring form
You need to maintain the original object state somewhere: Session (use @SessionAttributes) - this is the general solution Get it from the database before you write it back (use @ModelAttribute on a method) Store it on the client (hidden form vars) You also don't want to overwrite the values with nulls: use an @InitBinder method to set the allowedFields or disallowedFields on a DataBinder cre

Categories : Spring

Spring cache using memcached
Have you enabled Spring Cache in you application? If not then use @EnableCaching on the configuration bean. If it doesn't help check if the caching work if you use org.springframework.cache.support.SimpleCacheManager instead of SSMCacheManager. If not then there is still a problem with Spring Cache configuration.

Categories : Spring

How are these params used in @RequestMapping
Using 'params' we can narrow the request. And '!' negate the expression. So first method (userNameRegister) is looking for reuqets with USERNAME_PARAM but not EMAIL_PARAM whereas second one (emailRegister) is lookign for EMAIL_PARAM but not an USERNAME_PARAM

Categories : Spring

Spring Batch - Copying file from remote location
you can write a tasklet to achieve this this tasklet would be in separate step <step id="movingFile" next="step2"> <tasklet ref="voterImportFileMovingTasklet" /> <listeners> <listener ref="stepLevelListener" /> </listeners> </step> <step id="step2" > <chunk reader="FileReader" processor="ItemProcessor

Categories : Spring

Image upload using Hibernate inside PostgreSQL
In your Controller or method add below code for image BASE64Encoder base64Encoder = new BASE64Encoder(); StringBuilder imageString = new StringBuilder(); imageString.append("data:image/png;base64,"); imageString.append(base64Encoder.encode(bytes)); //bytes will be image byte[] come from DB String image = imageString.toString(); modelView.put("imagetoDisplay",image);// pu

Categories : Spring

application.propreties is ignored in spring
You need to add initializers = ConfigFileApplicationContextInitializer.class to the @ContextConfiguration. From its JavaDocs: * {@link ApplicationContextInitializer} that can be used with the * {@link ContextConfiguration#initializers()} to trigger loading of * {@literal application.properties}.

Categories : Spring

Authentication Success Handler for pre-authenticated scenario
You may implement your AuthenticatioSuccessHandler like this @Component public class MyAuthenticationSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler { @Autowired private UserService userService; @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws ServletExc

Categories : Spring

Passing Java Object via remote transport in Spring XD
XD uses Kryo serialization with remote transports. Java.io.serialization would work in theory, however we don't want to assume that payload types implement java.io.Serializable. Also, I personally don't see any advantage in choosing Java serialization automatically over Kryo if the payload is Serializable. Java serialization is supported via Spring XD's type conversion. You should be able to cr

Categories : Spring

Grails , resolve conflict between migration plugin and searchable plugin
Just till I get a permanent solution I did this. 1. comment out the searchable plugin in buildConfig.groovy ( It will be automatically uninstalled when you run the next grails command) 2. Do whatever you want to do with the migration plugin 3. uncomment the searchable plugin in buildConfig.groovy (It will be automatically installed when you run the next grails command) but still curios to know

Categories : Spring

elasticsearch- how to find exact date type values?
Usually it is safer to use the range filter instead of term/match when dealing with date fields. Elasticsearch internally stores date type as a long value. So I believe passing 1415987746214 while indexing should end up storing the value as is. Hence 1415987746214 is not the same as "14-11-2014 05:55:46". because of the millisecond portion. Try indexing it without the millisecond portion i.e

Categories : Spring

Paging And Sorting queries in Spring Data Cassandra
This is a documentation copy/paste error. Please enter a JIRA issue for the incorrect documentation. There is already an issue tracking whether paging & sorting can be supported at https://jira.spring.io/browse/DATACASS-56

Categories : Spring

Not able to Send Message specific to User using Spring Websocket STOMP
Just so this question stays out of the unanswered list - this is indeed a bug and you raised it as SPR-12444. This will be fixed in Spring Framework 4.1.3. As a side note, I'd like to point out that if you're deploying your application with multiple instances, session registries are not shared between instances by default - so this will cause issues when sending a message from a alice (with a se

Categories : Spring

Specifying more than one method parameters in sec:authorize access implementation
How are you integrating your CustomWebExpressionRoot with the application? To do this you need to ensure to create a custom WebExpressionHandler that registers the custom root. For example: CustomExpressionHandler.java public class CustomExpressionHandler extends DefaultWebSecurityExpressionHandler { @Override protected SecurityExpressionOperations createSecurityExpressionRoot(Authentica

Categories : Spring

spring security mapping for wildcards
You can try with a configuration like the following: @Configuration @EnableWebMvcSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private UserDetailsService _userService; @Autowired private PasswordEncoder _passwordEncoder; /** * Defines the password encoder used by Spring security during the * authentication procedure. */ @Bean p

Categories : Spring

Vaadin4spring and Vaadin Touchkit NavigationView
You should consider TouchKits NavigationView just as a normal Vaadin component, like VerticalLayout or Panel, not as a Vaadin Navigator View. So no need to annotate it with @VaadinView, but just with Component (~@VaadinComponent). If you want to use NavigationView components with Navigator, you'd need some other tricks. You'd at least need to make your view implement the View interface related to

Categories : Spring

Binding Spring Form Tags to A Map
I solved this by creating a postprocessing method in the backing controller: public void postprocessQuestions(RequestContext requestContext) { log.debug("Entered postprocessQuestions()"); TrainingForm form = (TrainingForm) requestContext.getFlowScope().get("trainingForm"); // manually get the reservation responses from the external request // context parameters Map<Strin

Categories : Spring

Adding a Filter and Init Params Progmatically
Try overriding onStartup() method and programatically register your filter with ServletContext like this: @Override public void onStartup(ServletContext servletContext) throws ServletException { FilterRegistration yahooFilter = servletContext.addFilter("yahooFilter", new YahooFilter()); yahooFilter.setInitParameter("oauthConnectionClass", "net.oauth.client.httpclient4.HttpClient4"); y

Categories : Spring

spring websocket status:400 websocket connect keep-alive
The request is technically correct as HTTP 1.1 accepts multiple fields with the same field-name (RFC2616 section 4.2). However, HttpHeaders will only take the first value, that's the reason. Remove the first Connection header or reorder them so Connection: Upgrade is picked.

Categories : Spring




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.