spring-mvc

private method with springmvc

让人想犯罪 __ 提交于 2020-12-12 01:49:38
问题 I have two methods in my controller: a public method a private method They all have @requestMapping and they all quotes a global variable( @autowrite ). The problem is that the first method the variable has value and the second method variable is null. Please help me. /** * Both of these methods are accessible through the browser, * when i ask for query1 the flowService has value but * when i ask for query2 the flowService is null. * My spring version is 4.2.4 * Created by hanxiaofei on 2017

java.lang.IllegalArgumentException: name

爷,独闯天下 提交于 2020-12-11 04:32:49
问题 "it work fine in eclipse but when i create jar and run it will give me this exception.This is non web spring boot application i am using which i supposed to run as standalone jar" java.lang.IllegalArgumentException: name at sun.misc.URLClassPath$Loader.findResource(Unknown Source) ~[na:1.8.0_171] at sun.misc.URLClassPath.findResource(Unknown Source) ~[na:1.8.0_171] at java.net.URLClassLoader$2.run(Unknown Source) ~[na:1.8.0_171] at java.net.URLClassLoader$2.run(Unknown Source) ~[na:1.8.0_171]

Spring Singleton scope vs application scope

↘锁芯ラ 提交于 2020-12-11 02:34:05
问题 What is the difference between the singleton and application spring scopes ? i know that the singleton scope creates one instance per application and the application scope is working in the same way, then what is the main difference ? i need an example to shows me the difference. 回答1: https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#beans-factory-scopes-application This is somewhat similar to a Spring singleton bean but differs in two important ways: It is a

java.net.MalformedURLException: unknown protocol: localhost at controller.RestController.addService(RestController.java:62)

无人久伴 提交于 2020-12-08 06:41:10
问题 I am trying to make a http post to server and I am getting a malformed url exception from my controller controller code public static final String REST_SERVICE_URI = "localhost:8081/create"; the method in the controller that receives the request from the server @RequestMapping(value="AddService",method = RequestMethod.POST) @ResponseBody public void addService(@ModelAttribute("servDetForm")) throws IOException{ //return dataServices.addService(tb); URL serv; URLConnection yc; try { serv = new

java.net.MalformedURLException: unknown protocol: localhost at controller.RestController.addService(RestController.java:62)

穿精又带淫゛_ 提交于 2020-12-08 06:39:11
问题 I am trying to make a http post to server and I am getting a malformed url exception from my controller controller code public static final String REST_SERVICE_URI = "localhost:8081/create"; the method in the controller that receives the request from the server @RequestMapping(value="AddService",method = RequestMethod.POST) @ResponseBody public void addService(@ModelAttribute("servDetForm")) throws IOException{ //return dataServices.addService(tb); URL serv; URLConnection yc; try { serv = new

Servlet filter prevents css from working

无人久伴 提交于 2020-12-08 02:19:24
问题 I'm working on a java project based on spring-MVC. I have users - students in this issue - which I'd like to check on each page they navigate, if they are logged it. So I wrote a web filter, that runs before each page loading and assures that user is logged in and is a student- except for login page ( obviously user is not logged in there :D) and home page which is reachable for everyone- however, when I added this filter to the project, all css got disabled, all images disappeared, and I

Spring retry find the last retry

六月ゝ 毕业季﹏ 提交于 2020-12-01 14:56:34
问题 I am using Spring-retry-1.2.0, Retry is working fine, but in my method i want to find it out whether the retrial is the last retrial or not, Is there any method available to get the retrialCount or last retrial in spring-retry? Retrial.java public class Offers extends SimpleRetryPolicy { @Async @Retryable(maxAttemptsExpression = "#{retrial.times}", backoff = @Backoff(delayExpression = "#{retrial.delay}")) public void handleOfferes(Data data) { AlwaysRetryPolicy policy = new AlwaysRetryPolicy(

Spring retry find the last retry

亡梦爱人 提交于 2020-12-01 14:55:53
问题 I am using Spring-retry-1.2.0, Retry is working fine, but in my method i want to find it out whether the retrial is the last retrial or not, Is there any method available to get the retrialCount or last retrial in spring-retry? Retrial.java public class Offers extends SimpleRetryPolicy { @Async @Retryable(maxAttemptsExpression = "#{retrial.times}", backoff = @Backoff(delayExpression = "#{retrial.delay}")) public void handleOfferes(Data data) { AlwaysRetryPolicy policy = new AlwaysRetryPolicy(

Spring retry find the last retry

久未见 提交于 2020-12-01 14:53:32
问题 I am using Spring-retry-1.2.0, Retry is working fine, but in my method i want to find it out whether the retrial is the last retrial or not, Is there any method available to get the retrialCount or last retrial in spring-retry? Retrial.java public class Offers extends SimpleRetryPolicy { @Async @Retryable(maxAttemptsExpression = "#{retrial.times}", backoff = @Backoff(delayExpression = "#{retrial.delay}")) public void handleOfferes(Data data) { AlwaysRetryPolicy policy = new AlwaysRetryPolicy(

Spring MVC Missing URI template variable

我的梦境 提交于 2020-11-30 08:35:10
问题 I have a Controller class with a function that saves a record to the Database. I am passing several parameters to the Controller function however i think i may be writing the @RequestMapping incorrectly. Under is the code Controller @RequestMapping(value="createRoadBlock.htm", method = RequestMethod.POST) public @ResponseBody Integer createRoadBlock(@RequestParam String purpose, @RequestParam String userName, @RequestParam int status, @RequestParam double latAdd, @RequestParam double longAdd,