07 2018 档案
摘要:微服务sudo pmset -a GPUSwitch 0 //强制使用集显sudo pmset -a GPUSwitch 1//强制使用独显sudo pmset -a GPUSwitch 2//自动切换模式
阅读全文
摘要:在测试类上加两个注解 @RunWith(SpringRunner.class) @SpringBootTest public class UserDaoTest { @Autowired private UserDao userDao; @Test public void testAddUser()
阅读全文
摘要:自定义配置springboot starter的步骤 1、配置一个类,配置类里面需要装配好要提供出去的类 2、使用1️⃣@enable,配置@import注解使用 2️⃣/META-INF、spring.factories 配置 org.springframework.boot.context.pr
阅读全文
摘要:AOP开发流程 1、加入依赖 spring-boot-starter-aop 自动开启AOP支持 2、写一个Aspect,封装横切关注点(日志、监控等),需要配置通知(前置、后置、环绕、异常...)和切入点(那些包的哪些方法等) @Before("execution(* com.lsq.spring
阅读全文
摘要:1、加载驱动 2、配置application.properties spring.datasource.driverClassName=com.mysql.jdbc.Driver spring.datasource.url=jdbc:mysql://192.168.0.104:3306/qiqisx
阅读全文
摘要:resource/src/webapp下的文件可以直接访问,以下为四个静态资源的路径,可以通过配置项修改 "classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/publ
阅读全文
摘要:规定请求方式 RequestMapping(value="/hello" Method=RequestMethod.GET) @RequestMapping(value="/hello" Method="Request.Method.GET") @ResponseBody public String
阅读全文
摘要:Springboot的运行流程 1、判断是否是web环境 2、加载左右Classpath下的META-INF/spring.factories ApplicationContextInitializer 3、加载所有classpath下的META-INF/spring.factories Appli
阅读全文
摘要:事件监听 方法一: //新建事件监听器。 实现ApplicationListener接口 import org.springframework.context.ApplicationListener; public class MyApplicationListener implements App
阅读全文
摘要:@EnableAutoConfiguration自动配置 其内部实现的关键点有 1、importselector该接口的方法返回值会被纳入到Spring容器中 2、SpringFactoriesloader可以从classpath中接收META-INF下的Spring.factories的配置文件
阅读全文
摘要:@Enable注解原理(视频09) 4个 使用@import()将Javabean导入Spring容器中 @SpringBootApplication @ComponentScan @Async//异步处理。bean 类之上 //@EnableAsync使异步处理生效 //@Import({User
阅读全文
摘要:Condition自动配置 @Conditional配合condition接口使用,只有借口的实现类返回true,才会装配 使用在方法上只对方法有效,使用在类上,对类所有方法有效 也可以传多个参数,表示这些参数都返回true才会装配 @SpringBootConfiguration public c
阅读全文
摘要:控制profile生效的两种方式 @SpringBootApplication public class App { public static void main(String[] args) { //使用默认profile ConfigurableApplicationContext conte
阅读全文
摘要:获取配置文件的三种方式 默认配置文件名application.properties application.yml @SpringBootApplication public class App { public static void main(String[] args) { Configura
阅读全文
摘要:springboot 快速入门 Springboot的环境搭建 1、继承 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version
阅读全文
摘要:pring 几个扩展点 ___________________________BeanPostProcesser___________________________ bean初始化时触发 在bean依赖装配(设置完成后)完成触发 这里可以指定Bean做一些处理,比如返回该对象的代理对象 @Comp
阅读全文
摘要:三种ApplicationContext依赖注入的方式 1、注解 @Component public class User { @Autowired private ApplicationContext applicationContext; public void show() { System.
阅读全文
摘要:javabean的的三种创建、装配 1、创建一个类实现FactoryBean接口 public class RunnableFactroyBean implments FactoryBean<Jeep>{ public Jeep getObject() throws Exception{ retur
阅读全文
浙公网安备 33010602011771号