spring-mvc

Spring MVC open index.jsp on “/”

…衆ロ難τιáo~ 提交于 2020-01-24 22:02:32
问题 How can I open index.jsp using this url http://localhost:8080/myApp/ and how can I use an hyperlink like this <a href="/">HOME</a> and go to index.jsp ( http://localhost:8080/myApp/ )? Here's my web.xml: <display-name>myApp</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:spring/application-config.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>

JUnit Error: “Failed to load ApplicationContext”

喜欢而已 提交于 2020-01-24 20:14:22
问题 Nothing seems to work I'm trying to run simple test: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"/applicationContext.xml"}) @Transactional public class EmailServiceTest { I've also tried: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"src/main/webapp/WEB-INF/applicationContext.xml"}) @Transactional public class EmailServiceTest { Along with a few different things in place of "location," such as "classpath" and "file." The

Hibernate EntityManager not being injected - NullPointer

早过忘川 提交于 2020-01-24 20:07:45
问题 I'm trying to use Hibernate and JPA in a Spring project but I have problems injecting the EntityManager. When I deploy the site and I open it, I get Request processing failed; nested exception is java.lang.NullPointerException because the manager is always null. This are my config files: pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0

spring JPA CRUD Repository and updating a record

隐身守侯 提交于 2020-01-24 19:31:06
问题 This is a question about a Spring Boot MVC application with Hibernate and PostgreSQL. I have a web page that allows a user to set administrative / configuration data for an application, and I want to store this data in a single database record. I have a POJO to contain the data. I have coded up a Spring MVC app that persists this data. The trouble is that each time the user saves the data (by doing a POST from the web page) the Spring application creates a new record in the database. I'm

sending HashMap by angularjs $http.get in spring mvc

≯℡__Kan透↙ 提交于 2020-01-24 19:19:01
问题 I want to send and retrieve HashMap through angularjs and receive it in springmvc controller. I have successfully send and received List but unable to send HashMap. My code is. $scope.addskill = function(skills){ // $scope.list = []; // $scope.list.push(skills.skillName, skills.expMonth, skills.expYear, skills.experties); var map = {}; map['name'] = skills.skillName; map['month'] = skills.expMonth; map['year'] = skills.expYear; map['experties'] = skills.experties; alert(map['name']); var

sending HashMap by angularjs $http.get in spring mvc

拜拜、爱过 提交于 2020-01-24 19:18:29
问题 I want to send and retrieve HashMap through angularjs and receive it in springmvc controller. I have successfully send and received List but unable to send HashMap. My code is. $scope.addskill = function(skills){ // $scope.list = []; // $scope.list.push(skills.skillName, skills.expMonth, skills.expYear, skills.experties); var map = {}; map['name'] = skills.skillName; map['month'] = skills.expMonth; map['year'] = skills.expYear; map['experties'] = skills.experties; alert(map['name']); var

Error while indexing in Hibernate Search (before transaction completion)

自闭症网瘾萝莉.ら 提交于 2020-01-24 18:16:11
问题 I am tired of banging my head around this problem So if anyone could suggest me where I am wrong I'll be grateful. The problem is I am using Spring-Batch and Hibernate Full-Text Search in my Spring MVC project.So from the batch job Tasklet I am calling following code: A a=aDao.merge(a); b.setA(a); bDao.save(b); While doing the save update on these entites I am getting an exception and the stacktrace is as follows: org.springframework.orm.hibernate3.HibernateSystemException: Error while

How to avoid the use of Spring annotations in my java beans and use them only in the configuration class?

烈酒焚心 提交于 2020-01-24 18:06:08
问题 I'm new in Spring and this is my first post here, I'm starting to use spring annotations, I was able to cofigure my project using XML configuration and now I'm able to configure it using only annotations and avoiding XML. But my current need is to avoid the use of annotations in my java classes (beans) and use it only in my AppConfig.java class which I use to configure Spring. This is my current working configuration: AppConfig.java @Configuration @ComponentScan(basePackageClasses=

How to avoid the use of Spring annotations in my java beans and use them only in the configuration class?

怎甘沉沦 提交于 2020-01-24 18:06:05
问题 I'm new in Spring and this is my first post here, I'm starting to use spring annotations, I was able to cofigure my project using XML configuration and now I'm able to configure it using only annotations and avoiding XML. But my current need is to avoid the use of annotations in my java classes (beans) and use it only in my AppConfig.java class which I use to configure Spring. This is my current working configuration: AppConfig.java @Configuration @ComponentScan(basePackageClasses=

jdbcAuthentication() instead of inMemoryAuthentication() doesn't give access - Spring Security and Spring Data JPA

左心房为你撑大大i 提交于 2020-01-24 14:08:52
问题 I'm just creating simple app using spring mvc, gradle, spring security, spring data jpa. Now I would like to test how spring security works, but I have a problem. First I show you little code then I will mention about my problem. Structure: Person.java package com.test.business; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "person") public class Person { @Id @Column(name = "id") private int