Spring 重要功能

--引用参考

1、读取本地管理的属性参数

<!-- Spring提供的读取属性文件cfg.properties参数的配置 -->
<bean id="configBean" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="ignoreResourceNotFound" value="true" />
<property name="locations">
<list>
<value>classpath:com/jy/cfg/properties/cfg.properties</value>
</list>
</property>
<property name="fileEncoding">
<value>UTF-8</value>
</property>
</bean>

使用:
/**
* 最大连接数
* (读本地cfg.properties配置文件)
*/
@Value("${jy.param.http.pool.maxTotal}")
private int maxTotal;


--浅谈Spring的PropertyPlaceholderConfigurer
[url]https://blog.csdn.net/blueboz/article/details/54808915[/url]
[url]https://www.cnblogs.com/dream-to-pku/p/6367396.html[/url]
[url]https://blog.csdn.net/u013491262/article/details/52489701[/url]
[url]https://blog.csdn.net/u013491262/article/details/52489701[/url]
[url]https://www.cnblogs.com/huqianliang/p/5673701.html[/url]

2、Spring提供的异步线程池实现多线程任务

//1、配置
<!-- 异步任务线程池 -->
<bean id="asyncTaskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="1"></property>
<property name="maxPoolSize" value="100"></property>
<property name="queueCapacity" value="30"></property>
</bean>
//2、使用
@Autowired
@Qualifier("asyncTaskExecutor")
private AsyncTaskExecutor asyncTaskExecutor;

Callable<String> callableTask= new Callable<String>() {
@Override
public String call() throws Exception {
final String url = HttpUtils.getNewUrl(request, baseUrl);
return httpClient.doOperation(url, headers);
}
};

return new WebAsyncTask<String>(20000L, asyncTaskExecutor, callableTask);

引用参考:
[url]https://www.cnblogs.com/leechenxiang/p/6365856.html[/url]
[url]https://www.cnblogs.com/redcool/p/6426173.html[/url]
[url]https://blog.csdn.net/lipc_/article/details/52786377[/url]
[url]https://blog.csdn.net/qq827245563/article/details/78194438[/url]
[url]https://blog.csdn.net/u012899746/article/details/72832120[/url]
[url]http://blog.51cto.com/winters1224/1885666[/url]
[url]https://my.oschina.net/kipeng/blog/1795538[/url]

3、Spring MVC的异步处理功能-- WebAsyncTask implements org.springframework.beans.factory.BeanFactoryAware
[url]https://blog.csdn.net/u013755987/article/details/62424001[/url]
[url]https://www.cnblogs.com/winner-0715/p/5759432.html[/url]
[url]https://www.cnblogs.com/yangzhilong/p/3725128.html[/url]
[url]https://blog.csdn.net/xiejx618/article/details/41285085[/url]
[url]http://ydlmlh.iteye.com/blog/2062788[/url]
[url]http://blueram.iteye.com/blog/1583117[/url]
//spring boot
[url]http://baijiahao.baidu.com/s?id=1591282944823321584&wfr=spider&for=pc[/url]
[url]http://www.spring4all.com/article/646[/url]

4、Spring mvc与Servlet-api
[url]https://www.cnblogs.com/yy3b2007com/p/8196391.html[/url]
[url]https://blog.csdn.net/sjyttkl/article/details/72757940[/url]
[url]https://www.2cto.com/kf/201507/417681.html[/url]
--SpringMVC-DispatcherServlet工作流程及web.xml配置
[url]https://www.cnblogs.com/yw0219/p/6084128.html[/url]
[url]http://jinnianshilongnian.iteye.com/blog/1602617[/url]
[url]https://www.cnblogs.com/yw0219/p/6086571.html[/url]
[url]https://blog.csdn.net/u014034854/article/details/47108507[/url]


5、spring-web.jar里面的org.springframework.web.filter.DelegatingFilterProxy
[url]https://blog.csdn.net/z69183787/article/details/23173093[/url]
[url]https://blog.csdn.net/romantic_pk/article/details/53082201[/url]
[url]https://blog.csdn.net/geloin/article/details/7441937[/url]
[url]https://www.cnblogs.com/hiver/p/4615418.html[/url]

6、spring-data-redis
Spring data redis-StringRedisTemplate 用法
[url]https://blog.csdn.net/fengzheku/article/details/49735785[/url]

7、使用bean
除了注解,老的方法:

import javax.servlet.ServletContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import java.text.MessageFormat;
@Override
public void init() throws ServletException {
String logStr="controller.DemoServlet.init...";
super.init();
ServletContext servletContext = this.getServletContext();
WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
loginService = (LoginService) context.getBean("loginService");
logger.info(MessageFormat.format(logStr+"loginService={0}", loginService));
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值