spring-mvc

Java:Spring: XML conflict on reading spring context.xml Duplicated definition for: 'identifiedType'

ε祈祈猫儿з 提交于 2020-01-31 15:39:12
问题 Any advise or help is much appreciated. There are many reference links, but there is no clear solution. I wonder how Spring projects interact with PLSQL procedures that returns XMLType output. you would need the XMLParser, and then we all will get this error, when used with Spring. Does anyone has any recommendations? I have a Maven spring app(mvc/Rest) which is running good, and I added the below dependencies for interacting with the PLSQL procedures, <dependency> <groupId>com.oracle<

What's difference between hibernate caching and Spring framework cache?

ぃ、小莉子 提交于 2020-01-31 08:54:09
问题 I have an application where I get the data from database (using hibernate). I want to load the cache (per user) with database state once per day and use the cache instead. I'm using Spring framework with Hibernate and I know that both of them have some caching possibilities. What are the differences between them? What would be a better choice? 回答1: Starting with Hibernate cache is a more prudent decision in my view, especially because the two don't exclude each other. In terms of performance

How to trigger a scheduled Spring Batch Job?

不羁岁月 提交于 2020-01-31 04:48:07
问题 I want to be able to start my job with a REST controller, then when the job is started, it should run on a scheduled basis, until i stop it again with REST. So this is my Controller: @RestController public class LauncherController { @Autowired JobLauncher jobLauncher; @Autowired Job job; @RequestMapping("/launch") public String launch() throws Exception { ... jobLauncher.run(job, jobParameters); } This is some part of the Batch conf: @Configuration @EnableBatchProcessing @EnableScheduling

@ComponentScan with multiple configuration class : Annotation Based Configuration

╄→尐↘猪︶ㄣ 提交于 2020-01-31 03:41:11
问题 As per Spring Doc- Configures component scanning directives for use with @Configuration classes. Provides support parallel with Spring XML's <context:component-scan> element. In my spring web application there are multiple files those are marked @Configuration ,in order to register @component bean in spring container- Question1- Can we use @ComponentScan in any of the @Configuration class or in all @Configuration classes? Question2- Also I seen in spring doc @Configuration @ComponentScan

Handle the same URL with Spring MVC RequestMappingHandlerMapping and Spring Websocket's ServletWebSocketHandlerRegistry

假如想象 提交于 2020-01-31 03:20:35
问题 What do I want to have: Client sends GET / HTTP/1.1 (without Connection: upgrade ) - this request should be handled by RequestMappingHandlerMapping Client sends Connection: upgrade along with GET request - this request should be handled by ServletWebSocketHandlerRegistry My Java configuration: @Configuration @EnableWebSocket public class WebsocketConfiguration extends WebMvcConfigurationSupport implements WebSocketConfigurer { @Bean WebsocketComponent wsHandler() { return new

How to loop through Map in Thymeleaf

放肆的年华 提交于 2020-01-31 01:00:08
问题 I am trying to understand how to loop through all entries in a Map in Thymeleaf. I have a domain object being processed by Thymeleaf that contains a Map. How do I loop through the keys and fetch the values ? Thanks. 回答1: Nevermind... I found it... <tr th:each="instance : ${analysis.instanceMap}"> <td th:text="${instance.key}">keyvalue</td> <td th:text="${instance.value.numOfData}">num</td> </tr> Thanks. 回答2: In case you have a List as the value. For example, when you have a map with key being

Spring MVC Controllers Unit Test not calling @ControllerAdvice

自作多情 提交于 2020-01-30 15:22:10
问题 I have a set of Controllers in the application and a class annotated as @ControllerAdvice which sets up certain data elements that are used in each of these controllers. I'm using Spring MVC 3.2 and have Junits for these controllers. When I run the Junit the control is not going to the ControllerAdvice class wheres it works fine if I deploy the app in Tomcat and submit a request through browser. Any thoughts please?. 回答1: After using the answer from @eugene-to and another similar one here I

How to manage/store request parameters for subsequent request in spring mvc?

让人想犯罪 __ 提交于 2020-01-30 11:52:26
问题 I frequently use scenario as: List users ( on ajax call ) On a search page, after search button click with some search criteria ., I have list of Users in jQuery datatable Click to Edit User In datatable I click to edit user from list, I redirects to a form for User update populated with user fields for updating purpose. Update User After successfully updating User, redirect to Search Page with search criteria from 1st Request . Currently I'm passing Search criteria parameters when I click to

How do i use Jackson Json parsing in a spring project without any annotations?

对着背影说爱祢 提交于 2020-01-30 06:39:45
问题 The Situation I have an enum class called Errors and it is in a common project. The errors enum contains an int code and a String text. The Errors enum is used in two different projects. One project is a Spring based project and the other project is in a non-Spring J2EE application. In the Spring based project, Jackson is the library used for converting the Errors enum to Json. So if there is a request we can return an Errors enum object and it will be automatically converted to the json

How do i use Jackson Json parsing in a spring project without any annotations?

纵饮孤独 提交于 2020-01-30 06:39:25
问题 The Situation I have an enum class called Errors and it is in a common project. The errors enum contains an int code and a String text. The Errors enum is used in two different projects. One project is a Spring based project and the other project is in a non-Spring J2EE application. In the Spring based project, Jackson is the library used for converting the Errors enum to Json. So if there is a request we can return an Errors enum object and it will be automatically converted to the json