常用类属于哪些jar包
Posted THISISPAN
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了常用类属于哪些jar包相关的知识,希望对你有一定的参考价值。
[email protected]注解,属于org.springframework.web.bind.annotation包下。org.springframework.web jar包。
[email protected]注解,也属于org.springframework.web.bind.annotation包下,org.springframework.web jar包。
都是spring mvc,也就是spring web jar包下
[email protected](basePackages = "com.pingan.property.icore.pap.*")注解,包扫面注解,属于spring下的jar包,context上下文中嘛,负责spring的ioc注入。
--->org.springframework.context.annotation;org.springframework.context jar包
[email protected] 属于org.springframework.boot.autoconfigure包下。org.springframework.boot jar包下。
[email protected](basePackages = "com.pingan.property.icore.pap.**.dao")注解,mapper当然属于mybatis了,所以属于mybatis的jar包下。
属于org.mybatis.spring.annotation;org.mybatis.spring jar包下。mybatis对接spring的jar包叫做org.mybatis.spring jar包
@SpringBootApplication @ComponentScan(basePackages = "com.pingan.property.icore.pap.*") @MapperScan(basePackages = "com.pingan.property.icore.pap.**.dao") public class DemoApplication implements EnvironmentAware { private RelaxedPropertyResolver propertyResolver; @Override public void setEnvironment(Environment env) { this.propertyResolver = new RelaxedPropertyResolver(env, "spring.datasource."); } @Bean(destroyMethod = "close", initMethod = "init") public DataSource dataSource() { DruidDataSource dataSource = new DruidDataSource(); dataSource.setUrl(propertyResolver.getProperty("url")); dataSource.setDriverClassName(propertyResolver.getProperty("driverClassName")); dataSource.setDefaultAutoCommit(Boolean.parseBoolean(propertyResolver.getProperty("defaultAutoCommit"))); return dataSource; } public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
[email protected]注解,属于org.springframework.context.annotation下,都是用来项目启动时向ioc容器中注入bean的注解。
@Bean(destroyMethod = "close", initMethod = "init") public DataSource dataSource() { DruidDataSource dataSource = new DruidDataSource(); dataSource.setUrl(propertyResolver.getProperty("url")); dataSource.setDriverClassName(propertyResolver.getProperty("driverClassName")); dataSource.setDefaultAutoCommit(Boolean.parseBoolean(propertyResolver.getProperty("defaultAutoCommit"))); return dataSource; }
6.EnvironmentAware 接口,属于org.springframework.context包下
7.RelaxedPropertyResolver类,属于org.springframework.boot.bind包下。
public class RelaxedPropertyResolver implements PropertyResolver,实现了PropertyResolver接口
以上是关于常用类属于哪些jar包的主要内容,如果未能解决你的问题,请参考以下文章