spring-mvc

@PreAuthorize on child class

一笑奈何 提交于 2020-01-07 04:31:05
问题 I have the following classes public abstract class BaseCotroller { @RequestMapping("/m") public String m() { ... } @RequestMapping("/n") public String n() { ... } } @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping("/a") public class ACotroller extends BaseController { @PreAuthorize("hasRole('ROLE_ADMIN')") @Override public String m() { return super.m(); } } @PreAuthorize gets applied for m, but not for n, though it should as @PreAuthorize is specified at the class level. Or do I missed

Spring MVC - redirect with jQuery

╄→гoц情女王★ 提交于 2020-01-07 03:55:27
问题 I am making an AJAX call to a controller, and I want to redirect to a new page on Success. So I have have the redirection logic within my success callback function. But it doesn't redirect to a new page instead it stays on the same page. The intriguing thing is that a GET Request (with the form Data I just sent via POST) is made after the Ajax Callback is executed. that is, I see a GET Request in the Address Bar. Here is my AJAX request $.ajax({ url: "processData", type: "POST", dataType:

springframework: Error creating bean with name 'userService':

感情迁移 提交于 2020-01-07 03:52:08
问题 I have a maven project which has spring framework integrated in it and i used this project to build web services for the mobile app. The project gives BeanCreationException when i deploy it on AWS ubuntu server and it fails to run on tomcat7. Where as it works fine when i run it in local environment. Below is the error log of tomcat7. WARN [localhost-startStop-1] DirectoryProviderHelper.makeSanityCheckedDirectory(258) | HSEARCH000041: Index directory not found, creating: '/usr/share/tomcat7

Two different authenticationManagers for two different dispatcherServlet

懵懂的女人 提交于 2020-01-07 03:41:07
问题 In my web.xml I have two different dispatcher servlets, one of them has all beans from root context, second dispatcher servlet has another authenticationManager. as sayed: In the Web MVC framework, each DispatcherServlet has its own WebApplicationContext, which inherits all the beans already defined in the root WebApplicationContext. The root WebApplicationContext should contain all the infrastructure beans that should be shared between your other contexts and Servlet instances. These

Collect all the method names in the flow of Spring MVC

此生再无相见时 提交于 2020-01-07 03:25:12
问题 I am new to Spring MVC . I am working on an application where before going to the login controller it does some process in security controller. I dont know to which all methods in my code is accessed while logging in. So i am trying to know if there is a way to log all the methods in the flow of application while logging in? Please help me. Thanks. 回答1: The cleanest and most proper way to do this is to have proper logging implemented in your application. That way, you would now exactly the

Prefixing JSON in MappingJackson2HttpMessageConverter

ぃ、小莉子 提交于 2020-01-07 03:17:25
问题 I've using Spring/AngularJS and to prevent JSON vulnerability, I'm trying to prefix all JSON array responses with ")]}',\n" - see reference. I was able to prefix by <mvc:annotation-driven> <mvc:message-converters> <bean id="mappingJackson2HttpMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" > <property name="jsonPrefix" value=")]}',\n" /> </bean> </mvc:message-converters> </mvc:annotation-driven> But the problem is it's prefixing all JSON

Angular CLI with Spring Boot

我怕爱的太早我们不能终老 提交于 2020-01-07 03:11:08
问题 I have 2 projects. An Angular2 app which I build with Angular-cli and a Spring Boot app which will only serve the Angular2 app. I build the Angular2 app with ng build which generates a dist folder. I then put the content of the dist folder in the Spring Boot app inside src/main/resources/static . My spring boot app has two files. The Spring boot application class : @SpringBootApplication public class SpringBoot extends SpringBootServletInitializer { @Override protected

http 406 error on restful web service

喜夏-厌秋 提交于 2020-01-07 02:22:08
问题 I have Spring MVC + JAXB web service and Flex client. I am getting HTTP 406 error when using RestFUL API. Here is request and response headers on image: Can you help me for solving this problem? 回答1: This problem comes when the data returned from the server is not in the format that is excepted by the browser. Also this can be caused by any one of the following: Accept : The MIME types accepted by the browser. For example, HTML files, GIF files etc. Accept-Charset : The character sets

exception is java.lang.IllegalStateException: Could not load JDBC driver class

与世无争的帅哥 提交于 2020-01-07 02:11:12
问题 I have code spring+hibernate using oracle database. I have setting the configuration but i still get an error like : cannot Deploy Spring3HibernateApp deploy is failing=Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:

exception is java.lang.IllegalStateException: Could not load JDBC driver class

独自空忆成欢 提交于 2020-01-07 02:11:06
问题 I have code spring+hibernate using oracle database. I have setting the configuration but i still get an error like : cannot Deploy Spring3HibernateApp deploy is failing=Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: