spring-mvc

Spring web service request and response for mapping having list of other objects

核能气质少年 提交于 2020-01-16 20:33:28
问题 I am using Spring web service and in my controller I am using @RequestBody and @ResponseBody. Now from what I understand these annotations do the magic of converting the incoming request to the class object that you specify. However, what if my class object had references to other class objects. Something like: public class Question { private String questionText; List<Options> options; public String getQuestionText() { return questionText; } public void setQuestionText(String questionText) {

Error loading class [org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor]

丶灬走出姿态 提交于 2020-01-16 19:14:36
问题 I have multiple errors while trying to start web app and initialize config. All necessary jars seems to be present. How to fix it? org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor] for bean with name 'persistenceExceptionTranslationPostProcessor' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: problem with class file or dependent class; nested exception is

Spring MVC 2.5 load property PropertiesFactoryBean doesn't return .properties info

我只是一个虾纸丫 提交于 2020-01-16 18:39:06
问题 I want to load a properties in my project with: <beans> ... <context:annotation-config /> <bean id="properties_es" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="location" value="classpath:/texts/report_es.properties" /> </bean> <bean id="properties_en" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="location" value="classpath:/texts/report_en.properties" /> </bean> </beans> And then I try to get both .properties

Hibernate and Spring integration error on connection pool and database creation

北城余情 提交于 2020-01-16 18:35:34
问题 I'm trying to make a web application that integrates Spring and Hibernate. What I get is not an exception, but my log continues to generate messages that, in my opinion, underline a problem in the db generation\connection. I declared an hsql database that I can access by the hsql swing manager, but the db file is not visible in the file explorer. Instead of test.db I get the following files: testdb.lck testdb.log testdb.properties testdb.script The log warning is the following message;

Cannot update my form in spring boot

旧城冷巷雨未停 提交于 2020-01-16 18:13:14
问题 My model is @Entity @Table(name = "sls_notifications") public class SLSNotification { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(length = 11) private Integer snumber; @JsonFormat(pattern="yyyy-MM-dd") @Column(nullable = false) private Date date = new Date(); @Column(length = 8) private String cusOffice; @Column(length = 1) private String cusSerial; @Column(length = 50) private String cusDecNo; @JsonFormat(pattern="yyyy-MM-dd") private Date cusDate; @Column(length = 300)

Thymleaf , loading fragments using jQuery

巧了我就是萌 提交于 2020-01-16 16:24:08
问题 I'm checking Thymeleaf with Spring these days. I came across a question on fragments. I've written a Spring controller using @Controller and there is a method @PostMapping below is the method @PostMapping(value="/xxx/yyy/add",consumes="application/json",produces="application/json") public @ResponseBody AModel addMethod(@Valid @RequestBody AModel aModel, BindingResult bindingResult) I've used $.ajax method to POST data to /xxx/yyy/add URL. JSON is mapped ith the AModel object and it works. But

FileNotFoundException with properties file

徘徊边缘 提交于 2020-01-16 13:14:32
问题 I'm trying to read some props from backupData.properties . It locates in WEB-INF/classes/ . This is how I do: public class Configures { private static final String INPUT_FILE = "WEB-INF//classes//backupData.properties"; public static String getMail() { Properties prop = new Properties(); try { //load a properties file prop.load(new FileInputStream(INPUT_FILE)); //get the property value return prop.getProperty("mail"); } catch (IOException ex) { ex.printStackTrace(); } return null; } } What

Spring Boot in standalone Tomcat ignores exceptions set in DeferredResults

五迷三道 提交于 2020-01-16 11:30:22
问题 I'm running a Spring Boot 1.2.1 application in standalone Tomcat. I have two controller mappings, which both for simplicity always throw an exception. The first one is for a GET request and it returns a String for the view name: @RequestMapping(value = { "/index" }, method = RequestMethod.GET) public String init() throws MyRequestProcessingException { if (true) { throw new MyRequestProcessingException( "Something went wrong processing request"); } return "init"; } This is the exception

Query inside a recursive function in JPQL

淺唱寂寞╮ 提交于 2020-01-16 06:27:49
问题 I am new to Jpa and jpql, I need to generate dropdown menu from a query. In codeigniter it was easy. I'd just do query inside a query in recursive function. Here is the sample function main_menu($base_id, $id=NULL, $class=NULL, $selected=NULL ) { $this->db->select('id, url, parent_id,title,'); $this->db->where('parent_id',$base_id); $this->db->order_by('sort_order','asc'); $query = $this->db->get('tbl_menu'); if($query->num_rows()>0) { if($this->level == 0) echo "<ul class='".$class."' id='".

How to get jasperreport file (.JRXML) exact location to load to the system?

半世苍凉 提交于 2020-01-16 06:27:44
问题 I trying to load jasper report (.jrxml) that i created, i named the report "JREmp1.xml". but i got this error "HTTP Status 500 - Request processing failed; nested exception is net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: D:\printpdf.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\JasperExample\jasper\JREmp1.jrxml (The system cannot find the path specified)" how to got the exact location? here is my JREmp1.xml file location : and here is code in my