
spring
文章平均质量分 67
gmemai
这个作者很懒,什么都没留下…
展开
-
Spring事务配置的五种方式
Spring配置文件中关于事务配置总是由三个组成部分,分别是DataSource、TransactionManager和代理机制这三部分,无论哪种配置方式,一般变化的只是代理机制这部分。 DataSource、TransactionManager这两部分只是会根据数据访问方式有所变化,比如使用Hibernate进行数据访问时,DataSource实际为SessionFactory,Transact转载 2015-09-18 21:58:18 · 449 阅读 · 0 评论 -
Injecting Spring Beans into Java Servlets
If you are working in a Java Web Application and you are using Spring IoC Container in your application, there is a chance that you might have to inject Spring Beans into a Java Servlet.Since there is转载 2015-09-04 23:50:36 · 435 阅读 · 0 评论 -
What's the point of Spring MVC's DelegatingFilterProxy?
I see this in my Spring MVC app’s web.xml:<filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class></filte转载 2015-09-05 21:29:05 · 863 阅读 · 0 评论 -
How to use Session attributes in Spring-mvc
Could you help me write spring mvc style analog so code in jsp and servlets? session.setAttribute("name","value");and how to add element, that annotate by @ModelAttribute annotation to session and afte转载 2015-09-09 07:14:22 · 677 阅读 · 0 评论 -
Spring 3 MVC: Create Hello World application in Spring 3.0 MVC
Things We NeedBefore we starts with our first Hello World Spring MVC Example, we will need few tools.JDK 1.5 aboveTomcat 5.x above or any other container (Glassfish, JBoss, Websphere, Weblogic etc)E转载 2015-09-02 16:51:08 · 406 阅读 · 0 评论 -
Get Session in Spring AOP
I am no sure if my codes is thread safe,anyone can help?@Aspectpublic class MyAspect { @Autowired private HttpSession session; @Before("...") private void myMethod() { seesion.getId(转载 2015-09-09 06:23:41 · 507 阅读 · 0 评论 -
Spring中取得session,request等對象
在使用spring時,經常需要在普通類中獲取session,request等對象比如一些AOP攔截器類,在有使用struts2時,因為struts2有一個接口使用org.apache.struts2.ServletActionContext即可很方便的取到session對像. 用法:ServletActionContext.getRequest().getSession(); 但在單獨使用spr转载 2015-09-08 19:39:42 · 371 阅读 · 0 评论 -
Spring 3 MVC – Introduction to Spring 3 MVC Framework
In Spring Web MVC you can use any object as a command or form-backing object; you do not need to implement a framework-specific interface or base class. Spring’s data binding is highly flexible: for ex转载 2015-09-02 13:32:00 · 374 阅读 · 0 评论 -
Spring 4 MVC HelloWorld Tutorial – Full XML Example
Following technologies being used:Spring 4.0.6.RELEASEMaven 3JDK 1.6Eclipse JUNO Service Release 2M2Eclipse plugin (Optional)Let’s begin.Step 1 : Create a new Maven webapp project in EclipseGoto转载 2015-09-01 04:49:29 · 864 阅读 · 0 评论 -
Spring MVC Display, Validate and Submit Form Example
In any web application, you often have to deal with forms. Application first displays a form and after user filled this form, he submits it to server. At server, application needs to capture input and转载 2015-08-31 15:49:40 · 776 阅读 · 0 评论 -
Spring MVC Custom Validator Example
In spring mvc form submit tutorial, we learned about displaying a form and submitting form data, including validating inputs using BindingResult.rejectValue(). In this example, we will learn to build a转载 2015-08-31 15:21:35 · 708 阅读 · 0 评论 -
Spring MVC Internationalization (i18n) and Localization (i10n) Example
Internationalization is the process of designing a software application so that it can potentially be adapted to various languages and regions without engineering changes. Localization is the process o转载 2015-08-31 15:13:19 · 1202 阅读 · 0 评论 -
Building a RESTful Web Service
This guide walks you through the process of creating a “hello world” RESTful web service with Spring.What you’ll buildYou’ll build a service that will accept HTTP GET requests at:http://localhost:8080/转载 2015-08-31 11:15:01 · 911 阅读 · 0 评论 -
Hello World Spring MVC Hello World
In this example, we will build a hello world web application using the Spring MVC framework. Spring MVC is one of the most important modules of the Spring framework. It builds on the powerful Spring Io转载 2015-08-31 14:03:50 · 488 阅读 · 0 评论 -
Spring Bean Validation Example with JSR-303 Annotations
JSR-303 bean validation is a specification whose objective is to standardize the validation of Java beans through annotations. The objective of the JSR-303 standard is to use annotations directly in a转载 2015-08-31 16:01:44 · 1136 阅读 · 0 评论 -
Spring REST Hello World XML Example
In this tutorial, I am writing hello world example for RESTful APIs using Spring REST features. In this example, I will be creating two APIs which will return XML representation of resources.Maven Depe转载 2015-08-31 10:15:16 · 730 阅读 · 0 评论 -
Spring AOP Example – Advice
Spring AOP (Aspect-oriented programming) framework is used to modularize cross-cutting concerns in aspects. Put it simple, it’s just an interceptor to intercept some processes, for example, when a meth转载 2015-09-06 10:50:39 · 427 阅读 · 0 评论 -
Spring AOP Example – Pointcut , Advisor
In last Spring AOP advice examples, the entire methods of a class are intercepted automatically. But for most cases, you may just need a way to intercept only one or two methods, this is what ‘Pointcut转载 2015-09-06 11:41:10 · 540 阅读 · 0 评论 -
Spring事务管理(annotation)
5.6 使用@Transactional除了使用XML类型的事务管理,同时Spring也提供了Annotation类型的事务管理。如下所示:// the service class that we want to make transactional@Transactionalpublic class DefaultFooService implements FooService { Foo转载 2015-09-19 00:47:59 · 367 阅读 · 0 评论 -
spring的annotation-driven配置事务管理器
基于3.0 假定spring 容器中定义了两个事务管理器:transactionManagerX,transactionManagerY,分管两个数据源datasourceX和datasourceY.<tx:annotation-driven transaction-manager="transactionManagerX" /><tx:annotation-driven transaction转载 2015-09-19 00:39:55 · 355 阅读 · 0 评论 -
Spring管理 hibernate 事务配置的五种方式
Spring配置文件中关于事务配置总是由三个组成部分,DataSource、TransactionManager和代理机制这三部分,无论是那种配置方法,变化的只是代理机制! 首先创建两个类,一个接口一个实现: package com.dao; public interface UserDao { public void getUser(); }转载 2015-09-18 22:23:24 · 391 阅读 · 0 评论 -
Spring管理Hibernate事务
1、TransactionProxyFactoryBean<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://转载 2015-09-18 22:08:02 · 318 阅读 · 0 评论 -
Spring AOP的实现原理之<aop:aspectj-autoproxy />的解析
本文主要针对注解形式的AOP作分析,即在application.xml用<aop:aspectj-autoproxy /> 当Spring 解析application.xml遇到上面提及的aop标签,而这个标签属于自定义标签,DefaultBeanDefinitionDocumentReader 委托delegate处理自定义标签 /** * Parse the elements转载 2015-09-06 17:22:06 · 2841 阅读 · 0 评论 -
Spring AOP + AspectJ in XML configuration example
For those don’t like annotation or using JDK 1.4, you can use AspectJ in XML based instead.Review last customerBo interface again, with few methods, later you will learn how to intercept it via AspectJ转载 2015-09-06 16:50:36 · 327 阅读 · 0 评论 -
Spring AOP(Aspect Oriented Programming) Tutorials
In the enterprise level application programming we used to add different cross-cutting functionalities [cross-cutting functionalities means adding different types of services to the application at runt转载 2015-09-06 13:50:34 · 459 阅读 · 0 评论 -
Spring AOP Interceptor transaction is not working
The Spring AOP transaction is not working in following interceptors? <bean id="testAutoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name转载 2015-09-06 11:43:27 · 544 阅读 · 0 评论 -
Spring之ContextLoaderListener的作用
I see this in my Spring MVC app’s web.xml:<filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class></filte转载 2015-09-06 19:57:16 · 452 阅读 · 0 评论 -
Spring AOP + AspectJ annotation example
In this tutorial, we show you how to integrate AspectJ annotation with Spring AOP framework. In simple, Spring AOP + AspectJ allow you to intercept method easily.Common AspectJ annotations :@Before –转载 2015-09-06 16:04:13 · 473 阅读 · 0 评论 -
SpringMVC中使用Interceptor拦截器
SpringMVC 中的Interceptor 拦截器也是相当重要和相当有用的,它的主要作用是拦截用户的请求并进行相应的处理。比如通过它来进行权限验证,或者是来判断用户是否登陆,或者是像12306 那样子判断当前时间是否是购票时间。一、定义Interceptor实现类SpringMVC 中的Interceptor 拦截请求是通过HandlerInterceptor 来实现的。在SpringMVC 中转载 2015-09-06 13:31:08 · 548 阅读 · 1 评论 -
Spring Auto proxy creator example
In last Spring AOP examples – advice, pointcut and advisor, you have to manually create a proxy bean (ProxyFactoryBean) for each beans whose need AOP support.This is not an efficient way, for example,转载 2015-09-06 12:34:11 · 379 阅读 · 0 评论 -
Spring AOP使用整理:使用@AspectJ风格的切面声明
要启用基于@AspectJ风格的切面声明,需要进行以下的配置: <!-- 启用@AspectJ风格的切面声明 --> <aop:aspectj-autoproxy proxy-target-class="true"/> <!-- 通过注解定义bean。默认同时也通过注解自动注入 --> <context:component-scan base-package=转载 2015-09-06 17:00:02 · 465 阅读 · 0 评论 -
Spring AOP Example Tutorial – Aspect, Advice, Pointcut, JoinPoint, Annotations, XML Configuration
Spring Framework is developed on two core concepts – Dependency Injection and Aspect Oriented Programming (AOP). Aspect Oriented Programming OverviewMost of the enterprise applications have some common转载 2015-09-06 15:48:54 · 934 阅读 · 0 评论 -
Spring AspectJ AOP 完整示例
首先新建一个maven项目,在项目的pom.xml中添加spring aop相关的依赖项: 如下是完整的pom.xml:<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mave转载 2015-09-06 17:17:12 · 551 阅读 · 0 评论 -
Spring REST Hello World JSON Example
1) Using @ResponseBody AnnotationThis technique is simple and easy. You have to include only jackson dependencies into classpath of your application and spring will register Jackson2JsonMessageConverte转载 2015-08-31 09:28:08 · 702 阅读 · 0 评论 -
Spring RESTFul Client – RestTemplate Example
After learning to build Spring REST based RESTFul APIs for XML representation and JSON representation, let’s build a RESTFul client to consume APIs which we have written. Accessing a third-party REST s转载 2015-08-31 16:14:46 · 1016 阅读 · 1 评论 -
Spring MVC InternalResourceViewResolver example
In Spring MVC, InternalResourceViewResolver is used to resolve “internal resource view” (in simple, it’s final output, jsp or html page) based on a predefined URL pattern. In additional, it allow you t转载 2015-08-25 08:14:43 · 467 阅读 · 0 评论 -
Spring MVC ParameterMethodNameResolver example
ParameterMethodNameResolver, a MultiActionController method name resolver to map URL to method name via request parameter name, and the parameter name is customizable through the “paramName” property.转载 2015-08-25 08:03:03 · 773 阅读 · 0 评论 -
Spring MVC MultiActionController annotation example
In this tutorial, we show you how to develop a Spring MVC annotation-based MultiActionController, by using @RequestMapping.In XML-based MultiActionController, you have to configure the method name reso转载 2015-08-25 06:45:05 · 457 阅读 · 0 评论 -
Spring MVC XmlViewResolver example
In Spring MVC, XmlViewResolver is used to resolve “view name” based on view beans in the XML file. By default, XmlViewResolver will loads the view beans from /WEB-INF/views.xml, however, this location转载 2015-08-25 08:19:03 · 387 阅读 · 0 评论 -
Spring MVC ParameterizableViewController example
In general, to return a view or page in Spring MVC application, you need to create a class, which extends the AbstractController , and return a ModelAndView() object.public class WelcomeController exte转载 2015-08-25 08:09:33 · 620 阅读 · 0 评论