SpringFramework(11) (完)

本文围绕Spring框架展开,介绍了WebApplicationContext的加载方式、适用的Web框架等Web相关内容,阐述了Web MVC的参考资料,还提及远程访问中Bean的输出方式及支持协议。此外,给出了Spring不同版本的功能特性及相关项目,如胖客户平台、验证等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

8Web

1WebApplicationContext

l         应用程序context位于war文件中

Ø         每个应用程序具有单一的根context

Ø         缺省是:/WEB-INF/applicationContext.xml

l         context被下面加载:

Ø         ContextLoaderListener(Servlet2.4)

Ø         ContextLoaderServlet(Servlet2.3)

l         可以使用任何的Web框架,Spring只是作为一个类库

l         例子:

Ø         web.xml

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>...web.context.ContextLoaderListener</listener-class>
</listener>

Ø         servlet

WebApplicationContextUtils.getWebApplicationContext(ServletContext);

 

9Web MVC

l         参考《Developoing a Sring Framework MVC application step-by-step》(即将翻译)

 

10、远程访问(Remoting

1RemoteExporter

l         context中的任何Bean多可以被输出

l         RemoteExporter以远程服务的方式输出Bean

l         内建支持:

Ø         RMI

Ø         JAX-RPC

Ø         Burlap

Ø         Hessian

2RmiServiceExporter

l         要被输出的服务

class MyServiceImpl implements MyService {
...
}
<bean id="myService" class="app.MyServiceImpl"/>

l         服务输出者

<bean id="myService-rmi"
class="...remoting.rmi.RmiServiceExporter">
<property name="service"><ref local="myService"/></property>
<property name="serviceInterface">
<value>app.MyService</value>
</property>
<property name="serviceName">
<value>myService</value>
</property>
</bean>

 

11、更多

1)线路图

l         Spring1.1

Ø         支持JMS

Ø         支持JMX

Ø         基于规则的声明式验证

Ø         AOP pointcut 表达式语言,JSR175 preview

l         Spring1.2

Ø         支持OGNL

Ø         支持JCA

Ø         增强RML支持

l         Spring1.3 ?

Ø         JSF

Ø         Portlets

2)相关的项目

l         胖客户平台(sandbox):Spring RCP

l         验证(sandbox):通用验证;基于属性

l         安全:Acegi Security System for Spring

 

(译者:2004728日,Spring Framework 1.1 RC1发布,与1.0相比,主要增加了AspectJ集成、JMS支持、远程访问和Web服务支持的增强,具体内容可以参考附带文档中的spring-reference.pdf

Standard Commons Logging discovery in action with spring-jcl: please remove commons-logging.jar from classpath in order to avoid potential conflicts . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/  :: Spring Boot ::   (v3.3.4) {"timestamp":"2025-07-30 11:23:02.433","severity":"INFO","logging.googleapis.com/labels":{"zwb_log":"batch","ProcessName":"SORB1048","ProcessID":"10712","ThreadID":"main","ClassName":"j.c.s.s.Application","MethodName":"logStarting","JOBID":"","DAGID":"","TASKID":"","REQID":""},"message":"Starting Application using Java 17.0.12 with PID 10712 (D:\SY22BNEC31\新しいフォルダー\order-batch-sorb1048-application\bin\main started by sycnc in D:\SY22BNEC31\新しいフォルダー\order-batch-sorb1048-application)"} {"timestamp":"2025-07-30 11:23:02.437","severity":"INFO","logging.googleapis.com/labels":{"zwb_log":"batch","ProcessName":"SORB1048","ProcessID":"10712","ThreadID":"main","ClassName":"j.c.s.s.Application","MethodName":"logStartupProfileInfo","JOBID":"","DAGID":"","TASKID":"","REQID":""},"message":"No active profile set, falling back to 1 default profile: "default""} {"timestamp":"2025-07-30 11:23:03.076","severity":"INFO","logging.googleapis.com/labels":{"zwb_log":"batch","ProcessName":"SORB1048","ProcessID":"10712","ThreadID":"main","ClassName":"o.s.b.c.c.a.BatchRegistrar","MethodName":"registerBeanDefinitions","JOBID":"","DAGID":"","TASKID":"","REQID":""},"message":"Finished Spring Batch infrastructure beans configuration in 7 ms."} {"timestamp":"2025-07-30 11:23:03.395","severity":"WARNING","logging.googleapis.com/labels":{"zwb_log":"batch","ProcessName":"SORB1048","ProcessID":"10712","ThreadID":"main","ClassName":"o.s.c.a.AnnotationConfigApplicationContext","MethodName":"refresh","JOBID":"","DAGID":"","TASKID":"","REQID":""},"message":"Exception encountered during context initialization - cancelling refresh attempt: java.lang.IllegalStateException: Unable to load cache item"} {"timestamp":"2025-07-30 11:23:03.423","severity":"INFO","logging.googleapis.com/labels":{"zwb_log":"batch","ProcessName":"SORB1048","ProcessID":"10712","ThreadID":"main","ClassName":"o.s.b.a.l.ConditionEvaluationReportLogger","MethodName":"logMessage","JOBID":"","DAGID":"","TASKID":"","REQID":""},"message":" Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled."} {"timestamp":"2025-07-30 11:23:03.459","severity":"ERROR","logging.googleapis.com/labels":{"zwb_log":"batch","ProcessName":"SORB1048","ProcessID":"10712","ThreadID":"main","ClassName":"o.s.b.SpringApplication","MethodName":"reportFailure","JOBID":"","DAGID":"","TASKID":"","REQID":""},"message":"Application run failed"} java.lang.IllegalStateException: Unable to load cache item at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:75) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:130) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:317) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:562) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:407) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.context.annotation.ConfigurationClassEnhancer.createClass(ConfigurationClassEnhancer.java:156) ~[spring-context-6.1.13.jar:6.1.13] at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:113) ~[spring-context-6.1.13.jar:6.1.13] at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:534) ~[spring-context-6.1.13.jar:6.1.13] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:311) ~[spring-context-6.1.13.jar:6.1.13] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:363) ~[spring-context-6.1.13.jar:6.1.13] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:153) ~[spring-context-6.1.13.jar:6.1.13] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:789) ~[spring-context-6.1.13.jar:6.1.13] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:607) ~[spring-context-6.1.13.jar:6.1.13] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-3.3.4.jar:3.3.4] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) [spring-boot-3.3.4.jar:3.3.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) [spring-boot-3.3.4.jar:3.3.4] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) [spring-boot-3.3.4.jar:3.3.4] at jp.co.sej.ssc.Application.main(Application.java:63) [main/:?] Caused by: java.lang.NoClassDefFoundError: com/google/crypto/tink/KmsClient at java.base/java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:?] at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3373) ~[?:?] at java.base/java.lang.Class.getDeclaredConstructors(Class.java:2555) ~[?:?] at org.springframework.cglib.proxy.Enhancer.generateClass(Enhancer.java:655) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.transform.TransformingClassGenerator.generateClass(TransformingClassGenerator.java:35) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:26) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.core.ClassLoaderAwareGeneratorStrategy.generate(ClassLoaderAwareGeneratorStrategy.java:57) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:366) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:575) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.lambda$new$1(AbstractClassGenerator.java:107) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.core.internal.LoadingCache.lambda$createEntry$1(LoadingCache.java:52) ~[spring-core-6.1.13.jar:6.1.13] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?] at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:57) ~[spring-core-6.1.13.jar:6.1.13] ... 18 more Caused by: java.lang.ClassNotFoundException: com.google.crypto.tink.KmsClient at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[?:?] at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[?:?] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?] at java.base/java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:?] at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3373) ~[?:?] at java.base/java.lang.Class.getDeclaredConstructors(Class.java:2555) ~[?:?] at org.springframework.cglib.proxy.Enhancer.generateClass(Enhancer.java:655) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.transform.TransformingClassGenerator.generateClass(TransformingClassGenerator.java:35) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:26) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.core.ClassLoaderAwareGeneratorStrategy.generate(ClassLoaderAwareGeneratorStrategy.java:57) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:366) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:575) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.lambda$new$1(AbstractClassGenerator.java:107) ~[spring-core-6.1.13.jar:6.1.13] at org.springframework.cglib.core.internal.LoadingCache.lambda$createEntry$1(LoadingCache.java:52) ~[spring-core-6.1.13.jar:6.1.13] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?] at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:57) ~[spring-core-6.1.13.jar:6.1.13] ... 18 more {"timestamp":"2025-07-30 11:23:03.470","severity":"ERROR","logging.googleapis.com/labels":{"zwb_log":"batch","ProcessName":"SORB1048","ProcessID":"10712","ThreadID":"main","ClassName":"j.c.s.s.Application","MethodName":"main","JOBID":"","DAGID":"","TASKID":"","REQID":""},"message":"異常 exitCode : 100 Exception : java.lang.IllegalStateException: Unable to load cache item"} {"timestamp":"2025-07-30 11:23:03.470","severity":"INFO","logging.googleapis.com/labels":{"zwb_log":"batch","ProcessName":"SORB1048","ProcessID":"10712","ThreadID":"main","ClassName":"j.c.s.s.Application","MethodName":"main","JOBID":"","DAGID":"","TASKID":"","REQID":""},"message":"終了"} 启动报错
最新发布
07-31
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值