spring-mvc

Spring boot 1.5.9, 404 error while accessing resources images within Docker container

你说的曾经没有我的故事 提交于 2020-04-11 06:46:08
问题 The bounty expires in 3 days . Answers to this question are eligible for a +100 reputation bounty. Dimitri Kopriwa is looking for an answer from a reputable source : I am still experiencing this and I am willing to help and add further information to understand and solve this issue. Currently, I am moving forward with a NodeJS fallback solution which will expose publicly those images. In a Spring Boot 1.5.9 application I want to access static resources through HTTP using Google Chrome. In

How to find controller name in @controllerAdvice or @RestControllerAdvice in Spring MVC?

烂漫一生 提交于 2020-04-10 05:40:37
问题 @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(NoHandlerFoundException.class) public ResponseEntity<Error> handle(NoHandlerFoundException ex){ String message = "HTTP " + ex.getHttpMethod() + " for " + ex.getRequestURL() + " is not supported."; Error error = new Error(HttpStatus.NOT_FOUND.value(), message); return new ResponseEntity<Error>(error, HttpStatus.NOT_FOUND); } } I am using @ControllerAdvice with @ExceptionHandler. I need to get the exception occurred

How to find controller name in @controllerAdvice or @RestControllerAdvice in Spring MVC?

对着背影说爱祢 提交于 2020-04-10 05:40:07
问题 @ControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(NoHandlerFoundException.class) public ResponseEntity<Error> handle(NoHandlerFoundException ex){ String message = "HTTP " + ex.getHttpMethod() + " for " + ex.getRequestURL() + " is not supported."; Error error = new Error(HttpStatus.NOT_FOUND.value(), message); return new ResponseEntity<Error>(error, HttpStatus.NOT_FOUND); } } I am using @ControllerAdvice with @ExceptionHandler. I need to get the exception occurred

How to use Alfresco 'Edit Online' functionality from Spring MVC application

99封情书 提交于 2020-04-10 04:33:05
问题 I am currently investigating Alfresco's Sharepoint functionality. I installed Alfresco 3.4 and followed the Web Quick Start Installation. I then uploaded a word document to Alfresco and can navigate to it in a browser. My URL is http://localhost:8080/share/page/site/webqs/document-details?nodeRef=workspace://SpacesStore/f7f5881e-320e-4d73-85e4-b62752fef1b8 Using Internet Explorer there is an 'Edit Online' button under the 'Document Actions' section. Sadly this button is not available with

Data Transfer Object DTO Where to build

杀马特。学长 韩版系。学妹 提交于 2020-04-10 04:19:51
问题 Trying to refactor some code. I see some classes creating DTO objects which are being passes in the service layer and returned later by the @RestController. As I know it is best to build the Data Transfer Objects only in the controllers and pass them to the views, especially when we use something like WrapperDTO<T> with get and set value. Maybe there are differences when we are building the WrapperDTO with complex object or simple data types. All oppinions will be well appreciated. 回答1: DTO

Spring MVC : Common param in all requests

£可爱£侵袭症+ 提交于 2020-04-09 18:24:46
问题 I have many controllers in my Spring MVC web application and there is a param mandatoryParam let's say which has to be present in all the requests to the web application. Now I want to make that param-value available to all the methods in my web-layer and service-layer. How can I handle this scenario effectively? Currently I am handling it in this way: ... controllerMethod( @RequestParam String mandatoryParam , ...) and, then passing this param to service layer by calling it's method 回答1:

No bean named 'transactionManager' available

馋奶兔 提交于 2020-04-08 10:38:56
问题 When I tried to create relationship using spring code, I am getting Transaction manager error. I am using Mysql and Neo4j database in my project. I tries different solution but not able to resolve. org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' available: No matching PlatformTransactionManager bean found for qualifier 'transactionManager' - neither qualifier match nor bean name match! Pom.xml file as below <?xml version="1.0" encoding="UTF

Spring @Async method inside a Service

允我心安 提交于 2020-04-08 08:53:12
问题 I have this Service bean with a sync method calling an internal async method: @Service public class MyService { public worker(){ asyncJob(); } @Async asyncJob(){ ... } } The trouble is that the asyncJob is not really call in async way. I found that this doesn't work because an internal call skips the AOP proxy . So I try to self-refer the bean: @Service public class MyService { MyService mySelf; @Autowired ApplicationContext cnt; @PostConstruct public init(){ mySelf=(MyService)cnt.getBean(

Make ServletContextListener spring aware

﹥>﹥吖頭↗ 提交于 2020-04-08 08:45:33
问题 I am plugging in Spring to existing Java EE web Application. I have following lines in my web.xml: <listener> <listener-class>com.MyContextListener</listener-class> </listener> And Following MyContextListener class? public class MyContextListener implements ServletContextListener { public void contextInitialized(ServletContextEvent event) { //... } } What should I do to make MyContextListener be managed by Spring? Edited: My assumption is: Spring should create all servlets and all web app

HTTP Status 405 - Request method 'PUT' not supported

女生的网名这么多〃 提交于 2020-04-06 02:29:06
问题 I have the following controller: @RestController public class RestaurantController { @Autowired RestaurantService restaurantService; @RequestMapping(value = "/restaurant/", method = RequestMethod.GET) public ResponseEntity<List<Restaurant>> listAllRestaurants() { System.out.println("Fetching all restaurants"); List<Restaurant> restaurants = restaurantService.findAllRestaurants(); if(restaurants.isEmpty()){ return new ResponseEntity<List<Restaurant>>(HttpStatus.NO_CONTENT);//You many decide to