spring-4

spring4.2.1, hibernate5 integrate abstract method error

断了今生、忘了曾经 提交于 2019-11-29 18:42:23
问题 I declare spring-framework 4.2.1.BUILD-SNAPSHOT and hibernate 5.0.0.BETA2 in my project, but I get an AbstractMethodError. Here is the stack trace: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) at org.springframework.test

Using @Scheduled and @EnableScheduling but gives NoSuchBeanDefinitionException

≯℡__Kan透↙ 提交于 2019-11-29 16:21:44
问题 I have followed very simple examples online to set up a cron job in Spring yet I keep getting this error in my Tomcat startup log each and every time: 2015-05-25 00:32:58 DEBUG ScheduledAnnotationBeanPostProcessor:191 - Could not find default TaskScheduler bean org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.scheduling.TaskScheduler] is defined 2015-05-25 00:32:58 DEBUG ScheduledAnnotationBeanPostProcessor:202 - Could not find

Changing password using Spring security

爷,独闯天下 提交于 2019-11-29 12:37:34
I use, Spring Framework 4.0.0 RELEASE (GA) Spring Security 3.2.0 RELEASE (GA) Struts 2.3.16 in which I use, org.springframework.security.authentication.dao.DaoAuthenticationProvider for authentication. My spring-security.xml file looks like the following. <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0

Maven : Spring 4 + Spring Security

≡放荡痞女 提交于 2019-11-29 10:57:43
问题 Can you explain to me how to properly build a web app with Spring? I know that the latest version of Spring framework is 4.0.0.RELEASE, but the latest version of Spring Security is 3.2.0.RELEASE, and it depends on spring 3.2.6... maybe i'm wrong :) How can I integrate it with Maven? Can I use Spring 4 or must I use the previous version? What is the proper way? If it`s not hard for you could you show me you pom.xml? 回答1: You should be fine using Spring 4. As described in the documentation: "

SpringMVC: Inconsistent mapping behavior depending on url extension

穿精又带淫゛_ 提交于 2019-11-29 06:49:46
I have a RESTful spring based endpoint to get assets stored in a db to a javascript editor. The relevant parts boil down to: @RestController @RequestMapping(ThemeEndpoint.ENDPOINT_NAME) public class ThemeEndpoint { public static final String ENDPOINT_NAME = "/themes"; @RequestMapping(value="/{id}/css/{assetName:.*}", method=RequestMethod.GET) public Asset getCssItem( @PathVariable("id") ThemeId id, @PathVariable("assetName") String name) { CssThemeAsset themeAsset = themeService.getCssAsset( id, ThemeAssetId.fromString(name)); Asset asset = new Asset(); asset.name = themeAsset.getName(); asset

Ambiguous @ExceptionHandler method mapped for [class org.springframework.web.bind.MethodArgumentNotValidException]

梦想与她 提交于 2019-11-29 00:17:17
问题 I'm trying to handle MethodArgumentNotValidException using @ControllerAdvice as code given below: @ControllerAdvice public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionHandler { private Logger log = LoggerFactory.getLogger(RestResponseEntityExceptionHandler.class); @Autowired private ApplicationContext applicationContext; @ExceptionHandler({ ConstraintViolationException.class }) @ResponseStatus(HttpStatus.BAD_REQUEST) @ResponseBody public ErrorWrapper

How to config “CommonsMultipartResolver” in spring4 without xml to upload file

跟風遠走 提交于 2019-11-28 21:14:24
I use xml config spring4 is work well.like this: <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" p:defaultEncoding="utf-8" > <!-- one of the properties available; the maximum file size in bytes --> <!-- <property name="maxUploadSize" value="40000000" /> --> </bean> when I config spring4 without xml.like this: @Configuration @ComponentScan({ "common.user", "service" }) @EnableWebMvc public class SpringMVCConfig { @Bean public ViewResolver createInternalResourceViewResolver() { InternalResourceViewResolver viewResolver = new

Relation between WebSecurityConfigurerAdapter and ResourceServerConfigurerAdapter

亡梦爱人 提交于 2019-11-28 18:17:06
I'm trying to integrate Spring OAuth2 into Spring MVC REST. Most of the Spring OAuth2 examples, there is only ResourceServerConfigurerAdapter and some of have WebSecurityConfigurerAdapter as well. I'm not going to integrate OAuth with Google, Facebook, etc. I'm trying to provide a token based authentication for Spring MVC REST which is currently based on Basic Authentication. Can someone exaplin me what is required and not or good resource to understand the Spring MVC REST +OAuth integration in a single server? Currently my POC works without WebSecurityConfigurerAdapter , but with

When use AbstractAnnotationConfigDispatcherServletInitializer and WebApplicationInitializer?

妖精的绣舞 提交于 2019-11-28 15:10:03
I am working with Spring 4.0.7 I did a research about configure Spring MVC through JavaConfig. Practically until yesterday I have seen two configurations using these two options extends AbstractAnnotationConfigDispatcherServletInitializer extends WebMvcConfigurerAdapter and implements WebApplicationInitializer Note : (2) are two classes, one for extension and the other for implementation I am using (2) because I have found many examples where I am able to configure converters, formatters, resources handlers etc… But in the latest days I have tried to help a question on StackOverflow and I did

How to turn on annotation driven validation in Spring 4?

天涯浪子 提交于 2019-11-28 11:44:01
I am using the annotation validation as below: public String processRegistration(@Valid Spitter spitter, Errors errors, Model model) { if (errors.hasErrors()) { return "registerForm"; } ... } But the errors.hasErrors() always return false. I guess I didn't turn on some kind of switch for the annotation driven validation. But how can I do it with JavaConfig in Spring 4? I tried to apply the @AnnotationDrivenConfig to the configuration class, but that type cannot even be resolved. ADD 1 I already have the following configuration in the servlet-context.xml , but still doesn't work. <annotation