spring-mvc

Loading both mvc-dispatcher-servlet.xml and applicationContext.xml?

心已入冬 提交于 2020-01-13 23:10:19
问题 I am using Spring 3 MVC. I have both mvc-dispatcher-servlet.xml and applicationContext.xml. But applicationContext.xml is not loading only mvc-dispatcher-servlet.xml is loading. Any problem with my configuration? web.xml <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <display-name>Archetype Created Web Application<

SPRING MVC - Use an external file as @PropertySource

送分小仙女□ 提交于 2020-01-13 19:39:44
问题 I was wondering how to use an external file to load some properties for my app in different contexts.. I know I can pass a file in PropertySource annotation. The problem is the path of the file. I mean, it looks like it want a full path to the file, but different environments have different paths for Tomcat directory. My question is: Where is the correct directory to store this files (it must be outside to the app dir otherwise on every deploy it is deleted) and how I can link it in my

SPRING MVC - Use an external file as @PropertySource

杀马特。学长 韩版系。学妹 提交于 2020-01-13 19:39:08
问题 I was wondering how to use an external file to load some properties for my app in different contexts.. I know I can pass a file in PropertySource annotation. The problem is the path of the file. I mean, it looks like it want a full path to the file, but different environments have different paths for Tomcat directory. My question is: Where is the correct directory to store this files (it must be outside to the app dir otherwise on every deploy it is deleted) and how I can link it in my

Spring Boot & Thymeleaf with XML Templates

老子叫甜甜 提交于 2020-01-13 18:57:09
问题 I have a Spring Boot application with a controller that returns a ModelAndView and Thymeleaf to render templates, where the templates live in /src/main/resources/templates/*.html This works fine, but How can I configure Spring and/or Thymeleaf to look for xml files instead of html? If it helps, I'm using Gradle with the org.springframework.boot:spring-boot-starter-web dependency to set things up. I am currently running the server using a class with a main method. 回答1: After trying and failing

Spring Security: Different authentication methods depending on entity

て烟熏妆下的殇ゞ 提交于 2020-01-13 18:56:27
问题 first post here, hope im doing right. In a project, we have a scenario where we have a single web application with multiple entities. Currently, the login is managed via default JDBC Spring Security provider, working fine. For a new requirement, we need that each entity can have their own login method (currently 2 methods would be available, the JDBC one, which is the current one, and the second method would be authentication via SAML, with each entity defining their own IdP, but this is

How to add error on Spring MVC simpleformcontroller?

北城以北 提交于 2020-01-13 18:26:15
问题 I have this problem in my Spring MVC 2.5 apps and I am not sure what should I do. Here is my code: public class AddStationController extends SimpleFormController { private SimpleStationManager stationManager; protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { StationDetails detail = (StationDetails) command; //add to DB int return = stationManager.addStation(detail); //return value: 1 = successful,

How to add error on Spring MVC simpleformcontroller?

你离开我真会死。 提交于 2020-01-13 18:26:10
问题 I have this problem in my Spring MVC 2.5 apps and I am not sure what should I do. Here is my code: public class AddStationController extends SimpleFormController { private SimpleStationManager stationManager; protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { StationDetails detail = (StationDetails) command; //add to DB int return = stationManager.addStation(detail); //return value: 1 = successful,

how to debug Spring MVC application on Spring Source Tool Suite

两盒软妹~` 提交于 2020-01-13 17:05:57
问题 Debugging in Spring Source Tool Suite Hi, i am using Spring Source Tool Suite for Spring MVC development. I have set breakpoints in controller to debug application. I am run my web application with following steps- 1)Set Breakpoints by double click in the margin beside the line of code 2)click Run > Debug As > Debug on Server but i don't get switched to debug mode. Please give me any suggestion to debug Spring MVC application. 回答1: Select Window-->Show View--> Servers . Right Click on server

Spring MVC 3.1 RedirectAttributes is not working

只愿长相守 提交于 2020-01-13 15:03:47
问题 I'm trying to implement RedirectAttributes feature in Spring MVC 3.1-Release I'm sending simple form to Post URL and would like to see the the value I'm sending in redirect: my Controller looks like this: @Controller public class DefaultController { @RequestMapping(value="/index.html", method=RequestMethod.GET) public ModelAndView indexView(){ ModelAndView mv = new ModelAndView("index"); return mv; } @RequestMapping(value="/greetings.action", method=RequestMethod.POST) public ModelAndView

Error deploying Grails application - Beginner

纵然是瞬间 提交于 2020-01-13 12:05:14
问题 I am having issues deploying a Grails application. Everything works in the local test environment. ERROR [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean