spring2
- 格式:ppt
- 大小:1.48 MB
- 文档页数:31
ABAQUS中快速建立和修改非线性弹簧Spring2的方法ABAQUS中建立非线性弹簧的方法整体的思路是:1.建立模型。
2.划分网格,需要注意的是划分网格时,接触的两个面上面划分的网格需要一样,保证接触的两个面划分完网格后的节点在同一个位置,方便后期建立弹簧单元。
3.建立点两个接触面的点的集合。
4.在Interaction中建立两个单元接触面的弹簧连接,建立一个就可以,便于后期编写inp。
5.建立job,并进行Check;再点击Write Input,生成inp文件,便于后期编辑。
6.进入后处理界面提取两个接触的面的节点编号和坐标。
7.采用Excel批量生成inp中的语句。
8.将生成的语句复制到inp文件对应位置。
9.在Job界面通过添加inp文件的方法提交模型进行计算。
下面将对每一个步骤进行详细的阐述。
1.建立模型2.划分网格在Mesh窗口中通过Seed Edges将接触面位置布置一定数量的种子,这里面是在圆弧上布置10个种子,高度方向布置20个种子。
在接触面的另外一个面对应的位置也需要布置相同数量的种子,如下图所示,在圆弧上布置10个种子,高度方向布置20个种子。
完成后划分网格。
便于后期建立点的集合,划分完成后见下图。
可以看出接触面两边的点是重合的。
3.建立点两个接触面的点的集合在Step中,选择Tools--Set—Manager,点击create新建集合,注意type选择Node。
最下面选择选取点的方式是by angle,这样可以一次性选择一个面上所有的点。
接触的两个面都必须要建立点的集合。
如下图所示。
4.在Interaction中建立两个单元接触面的弹簧连接在Interaction中,选择Special—Springs/Dashpots,选择接触面上相邻的两个点,建立弹簧单元,这里面不需要输入精确的的数据,只是为了后面编写inp时了解建立弹簧单元语句的格式要求和需要添加的位置。
具体见下图。
1对Hibernate的支持主要用到Spring的那个模块(B)(选择两项)A)Spring核心模块B)Spring ORM模块C)Spring MVC模块D)Spring Web模块2 Spring中around通知的目标对象要实现的接口是(D)A)MethodBeforeAdviceB)ThrowsAdviceC)AfterReturningAdviceD)MethodInterceptor3 Spring中Before通知的目标对象要实现的接口中before方法中的三个常用的参数依次是(A)A)方法,方法的参数,目标对象B)方法的参数,方法,目标对象C)目标对象,方法,方法的参数D)方法的参数,目标对象,方法4 Spring中around通知的目标对象要实现的接口中invoke中方法的参数是(C)A)方法B)目标对象C)方法执行参数D)Exception5 下面关于在Spring中配置Bean的init-method的说法正确的是(C)A)init-method是在最前面执行的B)init-method在构造方法后,依赖注入前执行C)init-method在依赖注入之后执行D)init-method在依赖注入之后,构造函数之前执行6 看下面的代码,说法正确的是(B)<bean id="userTable" class="erTable"> <property name="userName"><value>ACCP</value></property></bean>A)其中<property name="userName">的userName是UserTable 中的属性,可以不要get、set方法。
B)其中<property name="userName">的userName是UserTable 中的属性,可以不要get方法,但是一定要有set方法C)其中<property name="userName">的userName是UserTable 中的属性,可以不要set方法,但是一定要有get方法D)其中<property name="userName">的userName是UserTable 中的属性,一定要有get和set方法7 看下面的代码,说法正确的是(B)<bean id="beforeAdvisor" class="org.springframework.aop.support.RegexpMethodPointcutAd visor"><property name="advice"><ref local="beforeImpl"/></property><property name="pattern"><value>.*</value></property></bean>A)这段代码是在定义目标对象B)这段代码是在定义切入点C)这段代码是在定义代理D)这段代码是在定义织入8 Spring包装Hibernate之后,关于findByCriteria方法说话正确的是(C)A)参数是Restrictions对象B)参数是HQL语句C)参数是DetachedCriteria对象D)此方法不支持分页9 在web.xml文件中配置Spring框架,下面配置正确的是(D)A)<context-param><param-name>config</param-name><param-value>/WEB-INF/classes/applicationContext.xml</para m-value></context-param>B)<context-param><param-name>servletConfig</param-name><param-value>/WEB-INF/classes/applicationContext.xml</para m-value></context-param>C)<context-param><param-name>contextconfig</param-name><param-value>/WEB-INF/classes/applicationContext.xml</para m-value></context-param>D)<context-param><param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/classes/applicationContext.xml</param-value></context-param>10 下面关于BeanFactory接口说法正确的是(B )A)BeanFactory是单例模式的实现,负责创建和管理bean B)BeanFactory是工厂模式的实现,负责创建和管理beanC)ApplicationContext类是它的实现类D)以上说法都不对11 下面关于Spring管理Bean的说法正确的是(B )A)Bean在Spring容器中有两种管理方式,工厂模式和单例模式B)Bean在Spring容器中有两种管理方式,原型模式和单例模式C)Spring默认的利用工厂模式管理BeanD)Spring默认利用原型模式管理Bean12下面关于设置注入优点说法正确的是(C )A)构造期即创建一个完整、合法的对象B)需要写繁琐的setter方法的C)对于复杂的依赖关系,设置注入更简洁,直观D)以上说法都不对13 下面关于构造注入优点说法错误的是(C)A)构造期即创建一个完整、合法的对象B)不需要写繁琐的setter方法的C)对于复杂的依赖关系,构造注入更简洁,直观D)在构造函数中决定依赖关系的注入顺序14 关于Spring 与Hibernate集成,下面说法错误的是( C )A)Spring提供了HibernateDaoSupport类来简化Hibernate的使用B)在Spring配置文件种可以通过Spring提供的LocalSessionFactoryBean,来获得SessionFactory的实例C)通过集成Spring和Hibernate,用Spring管理程序的依赖关系,将SessionFactory注入到DataSource中D)通过Spring,可以在Biz层代码中无需直接实例化DAO类,而是通过注入得到15 Spring和Hibernate整合过程中各对象注入的顺序是( C )A)DataSource->SessionFactory-> Biz -> DAOB)SessionFactory -> DataSource ->DAO->BizC)DataSource->SessionFactory->DAO->BizD)SessionFactory -> DataSource -> Biz -> DAO二、多选题(每题2分,共15题,共30)1 Spring包装Hibernate之后,能够来保存数据的方法有(A C)(选择两项)A)saveB)loadC)saveOrUpdateD)merge2 Spring包装Struts的动作说法正确的是(B D)(选择两项)A)Action配置的type属性还是指向自己的Action类B)Action配置的type属性不需要指向自己的Action类,但是Action要在Spring配置文件中配置C)Action配置的type属性一定要指向Spring提供的代理类,但是Action要在Spring配置文件中配置D)Action配置的type属性可以不指向Spring提供的代理类,可以利用Spring提供的中央处理器来处理,但是Action要在Spring配置文件中配置3 Spring中提供通过Web容器来启动Spring框架的类有(AC )(选择两项)A)ContextLoaderListenerB)ServletLoaderListnerC)ContextLoaderServletD)ActionServlet4 Struts2同Spring集成的说法正确的是(AC )(选择两项)A)可以在struts.properties中增加一个配置:struts.beanFactory=springB)可以在struts.xml中配置一个<processor processorClass="org.springframework.web.struts.DelegatingRequestProcessor"></controller>的配置C)可以在struts.xml中增加一个<constant name="struts.beanFactory" value="spring" />D)可以在struts.xml中增加一个插件<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn" ><set-property property="contextConfigLocation" value="classpath:applicationContext.xml" /></plug-in>5 下面关于ApplicationContext的说法正确的是(BC )(选择两项)A)是BeanFactory的实现类B)是一个接口C)提供一些BeanFactory的扩展功能D)功能同BeanFactory一样6 下面是BeanFactory的实现类的是(AC )(选择两项)A)ClassPathXmlApplicationContextB)ApplicationContextC)FileSystemXmlApplicationContextD)以上都是7 下面关于AOP的理解正确的是(BC )(选择两项)A能够降低组件之间的依赖关系B将项目中的公共的问题集中解决,减少代码量,提高系统的可维护性C AOP是面向对象的代替品D AOP不是面向对象的代替品,是面向对象很好的补充8 关于Spring 与Hibernate集成,下面说法错误的是( C )A Spring提供了HibernateDaoSupport类来简化Hibernate的使用B在Spring配置文件种可以通过Spring提供的LocalSessionFactoryBean,来获得SessionFactory的实例C通过集成Spring和Hibernate,用Spring管理程序的依赖关系,将SessionFactory注入到DataSource中D通过Spring,可以在Biz层代码中无需直接实例化DAO类,而是通过注入得到9 Spring和Hibernate整合过程中各对象注入的顺序是( C )A DataSource->SessionFactory-> Biz -> DAOB SessionFactory -> DataSource ->DAO->BizC DataSource->SessionFactory->DAO->BizD SessionFactory -> DataSource -> Biz -> DAO10 Spring IOC容器管理Action的方式( AB )。
关于Spring中⼀级缓存、⼆级缓存和三级缓存的那些事⽬录题记缓存作⽤分析⼀级缓存、⼆级缓存、三级缓存区别是什么总结题记常常听到别⼈提起:“⼀级缓存、⼆级缓存、三级缓存”。
那么它们是什么呢?有什么作⽤呢?缓存作⽤分析Spring中的⼀级缓存名为singletonObjects,⼆级缓存名为earlySingletonObjects,三级缓存名为singletonFactories,除了⼀级缓存是ConcurrentHashMap之外,⼆级缓存和三级缓存都是HashMap。
它们的定义是在DefaultSingletonBeanRegistry类中。
⼀级缓存-singletonObjects是⽤来存放就绪状态的Bean。
保存在该缓存中的Bean所实现Aware⼦接⼝的⽅法已经回调完毕,⾃定义初始化⽅法已经执⾏完毕,也经过BeanPostProcessor实现类的postProcessorBeforeInitialization、postProcessorAfterInitialization⽅法处理;⼆级缓存-earlySingletonObjects是⽤来存放早期曝光的Bean,⼀般只有处于循环引⽤状态的Bean才会被保存在该缓存中。
保存在该缓存中的Bean所实现Aware⼦接⼝的⽅法还未回调,⾃定义初始化⽅法未执⾏,也未经过BeanPostProcessor实现类的postProcessorBeforeInitialization、postProcessorAfterInitialization⽅法处理。
如果启⽤了Spring AOP,并且处于切点表达式处理范围之内,那么会被增强,即创建其代理对象。
这⾥额外提⼀点,普通Bean被增强(JDK动态代理或CGLIB)的时机是在AbstractAutoProxyCreator实现的BeanPostProcessor的postProcessorAfterInitialization⽅法中,⽽处于循环引⽤状态的Bean被增强的时机是在AbstractAutoProxyCreator实现的SmartInstantiationAwareBeanPostProcessor的getEarlyBeanReference⽅法中。
Spring2连接多数据库,实现读写分离Spring2.0.1以后的版本已经支持配置多数据源,并且可以在运行的时候动态加载不同的数据源。
通过继承AbstractRoutingDataSource就可以实现多数据源的动态转换。
目前做的项目就是需要访问2个数据源,每个数据源的表结构都是相同的,所以要求数据源的变动对于编码人员来说是透明,也就是说同样SQL语句在不同的环境下操作的数据库是不一样的。
具体的流程如下:一、建立一个获得和设置上下文的类package com.lvye.base.dao.impl.jdbc;/**连接哪个数据源的环境变量* @author wenc*/public class JdbcContextHolder {private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>();public static void setJdbcType(String jdbcType) {contextHolder.set(jdbcType);}public static void setSlave(){setJdbcType("slave");}public static void setMaster(){clearJdbcType();}public static String getJdbcType() {return (String) contextHolder.get();}public static void clearJdbcType() {contextHolder.remove();}}二、建立动态数据源类,这个类必须继承AbstractRoutingDataSourcepackage com.lvye.base.dao.impl.jdbc;import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;public class DynamicDataSource extends AbstractRoutingDataSource{/* (non-Javadoc)* @see org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource#determineCurrentLook upKey()* @author wenc*/@Overrideprotected Object determineCurrentLookupKey() {return JdbcContextHolder.getJdbcType();}}这个类实现了determineCurrentLookupKey方法,该方法返回一个Object,一般是返回字符串。
springboot2Hikari多数据源配置问题(dataSourceClassName。
springboot 2 Hikari 多数据源配置问题(dataSourceClassName or jdbcUrl is required)最近在项⽬中想试⼀下使⽤ Hikari 连接池,以前⽤的是阿⾥的 Druid,框架是 Spring MVC,xml配置⽂件⽅式注⼊的 Bean,现在换成Spring Boot 之后,总遇到⼀些奇怪的问题,问题的根源是在于⾃⼰是个半桶⽔。
好了,先来看看 application.yml 配置⽂件:spring:jpa:show-sql: truedatasource:url: jdbc:mysql://localhost:3306/test?characterEncoding=utf8&useSSL=trueusername: rootpassword: roottype: com.zaxxer.hikari.HikariDataSourcehikari:maximum-pool-size: 20max-lifetime: 30000idle-timeout: 30000data-source-properties:prepStmtCacheSize: 250prepStmtCacheSqlLimit: 2048cachePrepStmts: trueuseServerPrepStmts: trueslave:url: jdbc:mysql://localhost:3306/test?characterEncoding=utf8&useSSL=trueusername: rootpassword: roottype: com.zaxxer.hikari.HikariDataSourcehikari:maximum-pool-size: 20max-lifetime: 30000idle-timeout: 30000data-source-properties:prepStmtCacheSize: 250prepStmtCacheSqlLimit: 2048cachePrepStmts: trueuseServerPrepStmts: true复制代码数据源配置⽂件:package org.seckill.config;import com.zaxxer.hikari.HikariDataSource;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.beans.factory.annotation.Qualifier;import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;import org.springframework.boot.context.properties.ConfigurationProperties;import org.springframework.boot.jdbc.DataSourceBuilder;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.context.annotation.Primary;import org.springframework.jdbc.core.JdbcTemplate;import javax.sql.DataSource;import java.util.HashMap;import java.util.Map;/**数据源配置@author jeftom@date 2019-04-14 12:03@since 1.0.0*/@Configurationpublic class DataSourceConfig {private final static Logger LOGGER = LoggerFactory.getLogger(DataSourceConfig.class);@Bean(name = "masterDataSource")@ConfigurationProperties(prefix = "spring.datasource")public DataSource masterDataSource(DataSourceProperties properties) {("init master data source:{}", properties);return DataSourceBuilder.create().build();}@Bean(name = "slaveDataSource")@ConfigurationProperties(prefix = "spring.datasource.slave")public DataSource slaveDataSource(DataSourceProperties properties) {("init slave data source:{}", properties);return DataSourceBuilder.create().build();}@Bean@Primarypublic DynamicDataSource dataSource(DataSource masterDataSource, DataSource slaveDataSource) {Map<String, DataSource> targetDataSources = new HashMap<>();targetDataSources.put(DataSourceEnum.MASTER.getName(), masterDataSource);targetDataSources.put(DataSourceEnum.SLAVE.getName(), slaveDataSource);<span class="hljs-built_in"><span class="hljs-built_in">return</span></span> new DynamicDataSource(masterDataSource, targetDataSources);}}复制代码报错信息:com.zaxxer.hikari.HikariConfig : HikariPool-1 - dataSource or dataSourceClassName or jdbcUrl is required.ng.IllegalArgumentException: dataSource or dataSourceClassName or jdbcUrl is required.at com.zaxxer.hikari.HikariConfig.validate(HikariConfig.java:955) ~[HikariCP-3.2.0.jar:na]复制代码百度了⼀下找到的解决⽅法:1. url 换成了 jdbc-url;2. 增加 driver-class-name: com.mysql.cj.jdbc.Driver试了⼀下,果然真的可以。
深⼊分析SpringBoot2,解决ng.ArrayStoreException异常将某个项⽬从Spring Boot1升级Spring Boot2之后出现如下报错,查了很多不同的解决⽅法都没有解决:Spring boot2项⽬启动时遇到了异常:ng.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxyCaused by: ng.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxyat sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724) ~[na:1.8.0_65]at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531) ~[na:1.8.0_65]at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355) ~[na:1.8.0_65]at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286) ~[na:1.8.0_65]at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) ~[na:1.8.0_65]at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72) ~[na:1.8.0_65]at ng.Class.createAnnotationData(Class.java:3521) ~[na:1.8.0_65]at ng.Class.annotationData(Class.java:3510) ~[na:1.8.0_65]at ng.Class.createAnnotationData(Class.java:3526) ~[na:1.8.0_65]at ng.Class.annotationData(Class.java:3510) ~[na:1.8.0_65]at ng.Class.getAnnotation(Class.java:3415) ~[na:1.8.0_65]at ng.reflect.AnnotatedElement.isAnnotationPresent(AnnotatedElement.java:258) ~[na:1.8.0_65]at ng.Class.isAnnotationPresent(Class.java:3425) ~[na:1.8.0_65]at org.springframework.core.annotation.AnnotatedElementUtils.hasAnnotation(AnnotatedElementUtils.java:570) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.isHandler(RequestMappingHandlerMapping.java:177) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:218) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:189) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:136) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1758) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1695) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]... 16 common frames omitted经过简单排查后,怀疑是因为jar版本冲突引起的异常,使⽤异常断点:然后在应该是从class org.activiti.spring.boot.SecurityAutoConfiguration出错,然后报错ng.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy尝试复现异常:SecurityAutoConfiguration securityAutoConfiguration=new SecurityAutoConfiguration();正常SecurityAutoConfiguration.class.getDeclaredAnnotation(Aspect.class);异常复现。
SpringBoot2整合Shiro报错UnavailableSecurityManage。
SpringBoot集成Shiro报错 UnavailableSecurityManagerException: No SecurityManager accessible to the calling code 【已解决】调试了好久,⽹上找了很多⽅法,,哎,太特么难受了,当知道原因的时候,,⼀万只草泥马在奔腾。
废话不多说,⾔归正传:1.报错⽇志信息org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton. This is an invalid application configuration. at org.apache.shiro.SecurityUtils.getSecurityManager(SecurityUtils.java:123) ~[shiro-core-1.5.1.jar:1.5.1]at org.apache.shiro.subject.Subject$Builder.<init>(Subject.java:626) ~[shiro-core-1.5.1.jar:1.5.1]at org.apache.shiro.SecurityUtils.getSubject(SecurityUtils.java:56) ~[shiro-core-1.5.1.jar:1.5.1]at com.shiro.demo.controller.LoginController.login(LoginController.java:26) ~[classes/:na]at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]at ng.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) ~[spring-webmvc-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) ~[spring-webmvc-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.2.4.RELEASE.jar:5.2.4.RELEASE]at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) ~[tomcat-embed-core-9.0.31.jar:9.0.31]at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.4.RELEASE.jar:5.2.4.RELEASE]at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.31.jar:9.0.31]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.31.jar:9.0.31]at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.31.jar:9.0.31]at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.31.jar:9.0.31]at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.4.RELEASE.jar:5.2.4.RELEASE]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367) [tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.31.jar:9.0.31]at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-9.0.31.jar:9.0.31]at .NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1639) [tomcat-embed-core-9.0.31.jar:9.0.31]at .SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.31.jar:9.0.31]at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.31.jar:9.0.31]at ng.Thread.run(Thread.java:745) [na:1.8.0_121]2.分析,我就搭了个简单的不能在简单,空⽩的不能在空⽩的的SpringBoot Web项⽬.- 引⼊了⼀个 Shiro-Spring的jar- ⼀个ShiroConfig的配置类- ⼀个⾃定义UserRealm类- ⼀个测试的Controller然后就报上⾯的错误,,哎。
(-1)写在前面这两天读《javaweb开发王者归来》,学到Spring的PropertyPlaceholderConfigurer 时出现一个问题,我已${}的形式赋值给bean中的属性,用main方法测试后,输出属性的值仍然是${}。
(0)解决问题之路a.我先想到是不是打错了,于是和书上仔细的对照了一下,发现书上说的是PropertyOverrideConfigurer,但实际上配置文件中写的是PropertyPlaceholderConfigurer,换来换去几次没用。
b.问了老师,在老师回去看资料的一瞬间突然有了灵感,我百度了一下,觉得找到了解决方案。
c.我想是不是没导入jar包、spring版本低,导致el表达式无法解析,一开始还一个个判定,后来把能导入的都导了还是不行,d.不断的换描述方式去百度我的问题,晚上有人要走了,提前一起吃一顿饭,吃晚饭去打lol,又百度了一会没有找到,于是在博问、问问上提问,到现在也没收到回复,英雄联盟输了一晚上,中途还断电了。
c.早上的时候想是不是main方法测试的原因,把项目部署到tomcat,在index.jsp中使用还是那样,于是乎我想到了是不是使用方式不对呢,之前也想到过PropertyPlaceholderConfigurer的bean是怎么和使用${}的bean关联到一起的,于是开始百度PropertyPlaceholderConfigurer的使用方法,间接的找到了解决方案。
(1)具体解决方案其实我觉得这个问题碰到的人真不多…,可能都是第一次学spring就读了这本书的人吧..,下面是其中一种方式配置文件<bean class="service.IDaoImp" id="iDaoImp" ><property name="name" value="${}"></property></bean><bean id="property"class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"><value>classpath:jdbc.properties</value></property></bean>main方法XmlBeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("applicationContext.xml")); PropertyPlaceholderConfigurer propertyPostProcessor = (PropertyPlaceholderConfigurer)beanFactory.getBean("property"); propertyPostProcessor.postProcessBeanFactory(beanFactory);IDaoImp imp = (IDaoImp)beanFactory.getBean("iDaoImp");System.out.println(imp.getName());IDaoImppublic class IDaoImp{private String name;public String getName() {return name;}public void setName(String name) { = name;}}jdbc.properties=\u738B\u65EDjdbc.age=21。
幼儿英语教案:读写“spring”2In this lesson, we will focus on the word "spring" and teach children how to read and write it in English.1.Warm-up ActivityTo start the lesson, we can do a fun warm-up activitythat gets children excited about spring. We can ask them questions such as:-What is your favorite thing about spring?-Have you seen any flowers blooming outside?-What animals do you see more often in the spring?We can also sing a spring-themed song together, such as "The Wheels on the Bus" but with the lyrics changed toinclude spring-related objects and actions (e.g. "The bunnies in the field go hop hop hop...").2. Introducing the VocabularyNext, we will introduce the word "spring" to the children. We can first show them a picture of spring scenery and ask them what they see - flowers, trees, green grass, etc. Then, we can write the word "spring" on the board and ask them torepeat after us. We can also do a spelling exercise where we say each letter of the word and ask the children to write it down on a piece of paper.3. Reading ExerciseAfter the children have familiarized themselves with the word "spring," we can do a reading exercise to reinforcetheir understanding. We can show them a short passage about spring and ask them to read it out loud with us. The passage can go something like this:"Spring is a beautiful season. The weather starts to warm up, and the flowers and trees begin to bloom. You might even see baby animals playing outside. It's a great time to go for a walk or have a picnic in the park!"4. Writing ExerciseThe last part of the lesson will be a writing exercise, where we ask the children to write the word "spring" on their own. We can provide them with a worksheet where they cantrace the word or write it on their own. To make it more interactive, we can also have them draw a picture ofsomething they associate with spring, such as a flower or a butterfly.Overall, this lesson is a fun and engaging way to teach young children about the spring season while also introducing them to new English vocabulary. By incorporating different exercises and activities, children can improve their reading and writing skills while also expanding their knowledge about the world around them.。