├── .classpath ├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── dictionaries │ └── liaokailin.xml ├── encodings.xml ├── libraries │ ├── Maven__aopalliance_aopalliance_1_0.xml │ ├── Maven__ch_qos_logback_logback_classic_1_1_3.xml │ ├── Maven__ch_qos_logback_logback_core_1_1_3.xml │ ├── Maven__com_fasterxml_classmate_1_2_0.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_annotations_2_4_6.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_core_2_4_6.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_databind_2_4_6.xml │ ├── Maven__com_fasterxml_jackson_datatype_jackson_datatype_guava_2_5_3.xml │ ├── Maven__com_fasterxml_jackson_jaxrs_jackson_jaxrs_base_2_5_3.xml │ ├── Maven__com_fasterxml_jackson_jaxrs_jackson_jaxrs_json_provider_2_5_3.xml │ ├── Maven__com_fasterxml_jackson_module_jackson_module_jaxb_annotations_2_5_3.xml │ ├── Maven__com_google_code_findbugs_annotations_2_0_0.xml │ ├── Maven__com_google_code_gson_gson_2_3_1.xml │ ├── Maven__com_google_guava_guava_18_0.xml │ ├── Maven__com_netflix_archaius_archaius_core_0_4_1.xml │ ├── Maven__com_netflix_hystrix_hystrix_core_1_4_10.xml │ ├── Maven__com_netflix_hystrix_hystrix_metrics_event_stream_1_4_10.xml │ ├── Maven__com_netflix_netflix_commons_netflix_commons_util_0_1_1.xml │ ├── Maven__com_netflix_netflix_commons_netflix_statistics_0_1_1.xml │ ├── Maven__com_netflix_ribbon_ribbon_2_1_0.xml │ ├── Maven__com_netflix_ribbon_ribbon_core_2_1_0.xml │ ├── Maven__com_netflix_ribbon_ribbon_httpclient_2_1_0.xml │ ├── Maven__com_netflix_ribbon_ribbon_loadbalancer_2_1_0.xml │ ├── Maven__com_netflix_ribbon_ribbon_transport_2_1_0.xml │ ├── Maven__com_netflix_servo_servo_core_0_9_2.xml │ ├── Maven__com_netflix_servo_servo_internal_0_9_2.xml │ ├── Maven__com_orbitz_consul_consul_client_0_9_8.xml │ ├── Maven__com_rabbitmq_amqp_client_3_5_1.xml │ ├── Maven__com_squareup_retrofit_retrofit_1_9_0.xml │ ├── Maven__com_sun_jersey_contribs_jersey_apache_client4_1_11.xml │ ├── Maven__com_sun_jersey_jersey_client_1_11.xml │ ├── Maven__com_sun_jersey_jersey_core_1_11.xml │ ├── Maven__commons_cli_commons_cli_1_2.xml │ ├── Maven__commons_codec_commons_codec_1_9.xml │ ├── Maven__commons_collections_commons_collections_3_2_1.xml │ ├── Maven__commons_configuration_commons_configuration_1_8.xml │ ├── Maven__commons_lang_commons_lang_2_6.xml │ ├── Maven__commons_logging_commons_logging_1_1_1.xml │ ├── Maven__io_dropwizard_metrics_metrics_core_3_1_0.xml │ ├── Maven__io_netty_netty_3_7_0_Final.xml │ ├── Maven__io_netty_netty_buffer_4_0_27_Final.xml │ ├── Maven__io_netty_netty_codec_4_0_27_Final.xml │ ├── Maven__io_netty_netty_codec_http_4_0_27_Final.xml │ ├── Maven__io_netty_netty_common_4_0_27_Final.xml │ ├── Maven__io_netty_netty_handler_4_0_27_Final.xml │ ├── Maven__io_netty_netty_transport_4_0_27_Final.xml │ ├── Maven__io_netty_netty_transport_native_epoll_4_0_27_Final.xml │ ├── Maven__io_reactivex_rxjava_1_0_10.xml │ ├── Maven__io_reactivex_rxnetty_0_4_9.xml │ ├── Maven__io_reactivex_rxnetty_contexts_0_4_9.xml │ ├── Maven__io_reactivex_rxnetty_servo_0_4_9.xml │ ├── Maven__io_springfox_springfox_core_2_0_3.xml │ ├── Maven__io_springfox_springfox_schema_2_0_3.xml │ ├── Maven__io_springfox_springfox_spi_2_0_3.xml │ ├── Maven__io_springfox_springfox_spring_web_2_0_3.xml │ ├── Maven__io_springfox_springfox_swagger2_2_0_3.xml │ ├── Maven__io_springfox_springfox_swagger_common_2_0_3.xml │ ├── Maven__io_springfox_springfox_swagger_ui_2_0_3.xml │ ├── Maven__io_swagger_swagger_annotations_1_5_0.xml │ ├── Maven__io_swagger_swagger_models_1_5_0.xml │ ├── Maven__javax_annotation_javax_annotation_api_1_2.xml │ ├── Maven__javax_inject_javax_inject_1.xml │ ├── Maven__javax_validation_validation_api_1_1_0_Final.xml │ ├── Maven__javax_ws_rs_javax_ws_rs_api_2_0_1.xml │ ├── Maven__joda_time_joda_time_2_5.xml │ ├── Maven__junit_junit_4_12.xml │ ├── Maven__log4j_log4j_1_2_17.xml │ ├── Maven__net_java_dev_javacc_javacc_5_0.xml │ ├── Maven__org_apache_commons_commons_lang3_3_0.xml │ ├── Maven__org_apache_commons_commons_pool2_2_2.xml │ ├── Maven__org_apache_httpcomponents_httpclient_4_3_6.xml │ ├── Maven__org_apache_httpcomponents_httpcore_4_3_3.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_core_8_0_23.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_el_8_0_23.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_logging_juli_8_0_23.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_0_23.xml │ ├── Maven__org_apache_zookeeper_zookeeper_3_5_0_alpha.xml │ ├── Maven__org_aspectj_aspectjrt_1_8_5.xml │ ├── Maven__org_aspectj_aspectjweaver_1_8_5.xml │ ├── Maven__org_glassfish_hk2_class_model_2_4_0_b06.xml │ ├── Maven__org_glassfish_hk2_config_types_2_4_0_b06.xml │ ├── Maven__org_glassfish_hk2_core_2_4_0_b06.xml │ ├── Maven__org_glassfish_hk2_external_aopalliance_repackaged_2_4_0_b31.xml │ ├── Maven__org_glassfish_hk2_external_asm_all_repackaged_2_4_0_b06.xml │ ├── Maven__org_glassfish_hk2_external_bean_validator_2_4_0_b06.xml │ ├── Maven__org_glassfish_hk2_external_javax_inject_2_4_0_b31.xml │ ├── Maven__org_glassfish_hk2_hk2_2_4_0_b06.xml │ ├── Maven__org_glassfish_hk2_hk2_api_2_4_0_b31.xml │ ├── Maven__org_glassfish_hk2_hk2_config_2_4_0_b06.xml │ ├── Maven__org_glassfish_hk2_hk2_locator_2_4_0_b31.xml │ ├── Maven__org_glassfish_hk2_hk2_runlevel_2_4_0_b06.xml │ ├── Maven__org_glassfish_hk2_hk2_utils_2_4_0_b31.xml │ ├── Maven__org_glassfish_hk2_osgi_resource_locator_1_0_1.xml │ ├── Maven__org_glassfish_hk2_spring_bridge_2_4_0_b06.xml │ ├── Maven__org_glassfish_jersey_bundles_repackaged_jersey_guava_2_21.xml │ ├── Maven__org_glassfish_jersey_containers_jersey_container_servlet_2_14.xml │ ├── Maven__org_glassfish_jersey_containers_jersey_container_servlet_core_2_14.xml │ ├── Maven__org_glassfish_jersey_core_jersey_client_2_21.xml │ ├── Maven__org_glassfish_jersey_core_jersey_common_2_21.xml │ ├── Maven__org_glassfish_jersey_core_jersey_server_2_14.xml │ ├── Maven__org_glassfish_jersey_ext_jersey_bean_validation_2_14.xml │ ├── Maven__org_glassfish_jersey_ext_jersey_spring3_2_14.xml │ ├── Maven__org_glassfish_jersey_media_jersey_media_json_jackson_2_14.xml │ ├── Maven__org_hamcrest_hamcrest_core_1_3.xml │ ├── Maven__org_hamcrest_hamcrest_library_1_3.xml │ ├── Maven__org_hibernate_hibernate_validator_5_1_3_Final.xml │ ├── Maven__org_immutables_value_2_0_16.xml │ ├── Maven__org_javassist_javassist_3_18_1_GA.xml │ ├── Maven__org_jboss_logging_jboss_logging_3_1_3_GA.xml │ ├── Maven__org_jvnet_tiger_types_1_4.xml │ ├── Maven__org_mapstruct_mapstruct_1_0_0_Beta4.xml │ ├── Maven__org_mockito_mockito_core_1_10_19.xml │ ├── Maven__org_mongodb_mongo_java_driver_2_12_5.xml │ ├── Maven__org_objenesis_objenesis_2_1.xml │ ├── Maven__org_slf4j_jcl_over_slf4j_1_7_12.xml │ ├── Maven__org_slf4j_jul_to_slf4j_1_7_12.xml │ ├── Maven__org_slf4j_log4j_over_slf4j_1_7_12.xml │ ├── Maven__org_slf4j_slf4j_api_1_7_12.xml │ ├── Maven__org_slf4j_slf4j_log4j12_1_7_12.xml │ ├── Maven__org_springframework_amqp_spring_amqp_1_4_5_RELEASE.xml │ ├── Maven__org_springframework_amqp_spring_rabbit_1_4_5_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_1_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_actuator_1_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_autoconfigure_1_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_1_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_actuator_1_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_amqp_1_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_aop_1_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_data_mongodb_1_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_jersey_1_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_logging_1_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_redis_1_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_test_1_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_tomcat_1_2_4_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_web_1_2_4_RELEASE.xml │ ├── Maven__org_springframework_data_spring_data_commons_1_9_2_RELEASE.xml │ ├── Maven__org_springframework_data_spring_data_mongodb_1_6_2_RELEASE.xml │ ├── Maven__org_springframework_data_spring_data_redis_1_4_2_RELEASE.xml │ ├── Maven__org_springframework_hateoas_spring_hateoas_0_16_0_RELEASE.xml │ ├── Maven__org_springframework_plugin_spring_plugin_core_1_1_0_RELEASE.xml │ ├── Maven__org_springframework_plugin_spring_plugin_metadata_1_2_0_RELEASE.xml │ ├── Maven__org_springframework_retry_spring_retry_1_1_2_RELEASE.xml │ ├── Maven__org_springframework_spring_aop_4_1_6_RELEASE.xml │ ├── Maven__org_springframework_spring_beans_4_1_6_RELEASE.xml │ ├── Maven__org_springframework_spring_context_4_1_6_RELEASE.xml │ ├── Maven__org_springframework_spring_context_support_4_1_6_RELEASE.xml │ ├── Maven__org_springframework_spring_core_4_1_6_RELEASE.xml │ ├── Maven__org_springframework_spring_expression_4_1_6_RELEASE.xml │ ├── Maven__org_springframework_spring_messaging_4_1_6_RELEASE.xml │ ├── Maven__org_springframework_spring_test_4_1_6_RELEASE.xml │ ├── Maven__org_springframework_spring_tx_4_1_6_RELEASE.xml │ ├── Maven__org_springframework_spring_web_4_1_6_RELEASE.xml │ ├── Maven__org_springframework_spring_webmvc_4_1_6_RELEASE.xml │ ├── Maven__org_yaml_snakeyaml_1_14.xml │ └── Maven__redis_clients_jedis_2_5_2.xml ├── misc.xml ├── modules.xml ├── vcs.xml └── workspace.xml ├── .project ├── .settings ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs └── org.eclipse.m2e.core.prefs ├── pom.xml ├── springboot.iml └── src ├── main ├── java │ └── com │ │ └── lkl │ │ └── springboot │ │ ├── Application.java │ │ ├── adapter │ │ └── MyWebMvcConfigurerAdapter.java │ │ ├── amqp │ │ ├── AmqpConfig.java │ │ ├── Receive.java │ │ └── Send.java │ │ ├── annotation │ │ └── NoAuth.java │ │ ├── aop │ │ └── ServiceMonitor.java │ │ ├── archaius │ │ └── LoadProperties.java │ │ ├── asm │ │ └── LoadAnnotationMetadata.java │ │ ├── async │ │ ├── AsynConfig.java │ │ ├── AsyncCall.java │ │ ├── AsyncSchedulConfig.java │ │ └── schedul │ │ │ ├── SchedulCall.java │ │ │ └── SchedulConfig.java │ │ ├── clr │ │ ├── MyCommandLineRunner01.java │ │ └── MyCommandLineRunner02.java │ │ ├── concurrent │ │ └── limit │ │ │ └── MySimpleAsyncTaskExecutor.java │ │ ├── config │ │ ├── AppConfig.java │ │ ├── AppConfig2.java │ │ ├── AppConfig3.java │ │ └── MyConfig.java │ │ ├── consul │ │ ├── ConsulDemo.java │ │ └── ConsulSession.java │ │ ├── controller │ │ ├── MyController.java │ │ ├── MyRestController.java │ │ └── ZipkinController.java │ │ ├── domain │ │ ├── Order.java │ │ ├── Person.java │ │ └── User.java │ │ ├── encrypt │ │ └── Encrypt.java │ │ ├── endpoint │ │ ├── AllEndPoint.java │ │ └── CusEndPoint.java │ │ ├── exception │ │ ├── RestException.java │ │ └── handler │ │ │ ├── MyControllerAdvice.java │ │ │ └── MyExceptionHandler.java │ │ ├── filter │ │ └── TestFileter.java │ │ ├── health │ │ └── MyHealthCheck.java │ │ ├── hystrix │ │ ├── CommandCollapserGetValueForKey.java │ │ ├── CommandFacadeWithPrimarySecondary.java │ │ ├── CommandHelloWorld01.java │ │ ├── CommandWithFallbackViaNetwork.java │ │ ├── HelloWorldCommand02.java │ │ ├── HystrixConfig.java │ │ ├── RequestCacheCommand.java │ │ ├── SemaphoreIsolation.java │ │ └── TestCommandCollapsing.java │ │ ├── importresource │ │ └── ImportResourceFoo.java │ │ ├── lifecycle │ │ └── MyLifecycle.java │ │ ├── listener │ │ ├── ApplicationEnvironmentPreparedEventListener.java │ │ ├── ApplicationFailedEventListener.java │ │ ├── ApplicationPreparedEventListener.java │ │ └── ApplicationStartedEventListener.java │ │ ├── metric │ │ ├── CusMetric.java │ │ └── MetricsDemo.java │ │ ├── mongodb │ │ ├── MongoTest.java.bak │ │ └── PersonRepository.java │ │ ├── redis │ │ └── RedisConfig.java │ │ ├── response │ │ └── SpringBootResponse.java │ │ ├── retrofit │ │ ├── RetrofitClient.java │ │ └── RetrofitService.java │ │ ├── ribbon │ │ └── SampleApp.java │ │ ├── rxjava │ │ ├── MethodTest.java │ │ └── SampleDemo.java │ │ ├── service │ │ └── PersonService.java │ │ ├── servlet │ │ └── HelloWorldServlet.java │ │ ├── sort │ │ └── MyTestSort.java │ │ ├── swagger │ │ └── SwaggerConfig.java │ │ ├── type │ │ └── TypeTest.java │ │ ├── utils │ │ ├── AuthTokenUtils.java │ │ └── ParamParseUtil.java │ │ ├── zipkin │ │ └── BraveConfig.java │ │ └── zookeeper │ │ ├── DataMonitor.java │ │ ├── Executor.java │ │ └── ZookeeperFoo.java └── resources │ ├── application.properties │ ├── application.yml │ ├── banner.txt │ ├── config.properties │ ├── logback.xml.bak │ ├── sample-client.properties │ ├── validator.properties │ └── xml_config.xml └── test └── java └── com └── lkl └── framework ├── CusEvent.java ├── CusEventListener.java ├── EventSourceObject.java ├── GenericTypeResolverTest.java ├── HeadlessBasics.java ├── ParseAnnotation.java ├── Singleton.java ├── StrSubstitutorTest.java └── TestEvent.java /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /static-analysis/ 2 | /.settings/ 3 | target 4 | generated 5 | .* 6 | !.gitignore 7 | **/*.iml 8 | test-output/ 9 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | springboot -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 33 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/dictionaries/liaokailin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__aopalliance_aopalliance_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_classmate_1_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_4_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_4_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_4_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_guava_2_5_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_jaxrs_jackson_jaxrs_base_2_5_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_jaxrs_jackson_jaxrs_json_provider_2_5_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_module_jackson_module_jaxb_annotations_2_5_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_code_findbugs_annotations_2_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_code_gson_gson_2_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_guava_guava_18_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_netflix_archaius_archaius_core_0_4_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_netflix_hystrix_hystrix_core_1_4_10.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_netflix_hystrix_hystrix_metrics_event_stream_1_4_10.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_netflix_netflix_commons_netflix_commons_util_0_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_netflix_netflix_commons_netflix_statistics_0_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_netflix_ribbon_ribbon_2_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_netflix_ribbon_ribbon_core_2_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_netflix_ribbon_ribbon_httpclient_2_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_netflix_ribbon_ribbon_loadbalancer_2_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_netflix_ribbon_ribbon_transport_2_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_netflix_servo_servo_core_0_9_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_netflix_servo_servo_internal_0_9_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_orbitz_consul_consul_client_0_9_8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_rabbitmq_amqp_client_3_5_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_squareup_retrofit_retrofit_1_9_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_sun_jersey_contribs_jersey_apache_client4_1_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_sun_jersey_jersey_client_1_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_sun_jersey_jersey_core_1_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_cli_commons_cli_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_codec_commons_codec_1_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_collections_commons_collections_3_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_configuration_commons_configuration_1_8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_logging_commons_logging_1_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_dropwizard_metrics_metrics_core_3_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_netty_netty_3_7_0_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_netty_netty_buffer_4_0_27_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_netty_netty_codec_4_0_27_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_netty_netty_codec_http_4_0_27_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_netty_netty_common_4_0_27_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_netty_netty_handler_4_0_27_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_netty_netty_transport_4_0_27_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_netty_netty_transport_native_epoll_4_0_27_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_reactivex_rxjava_1_0_10.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_reactivex_rxnetty_0_4_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_reactivex_rxnetty_contexts_0_4_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_reactivex_rxnetty_servo_0_4_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_springfox_springfox_core_2_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_springfox_springfox_schema_2_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_springfox_springfox_spi_2_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_springfox_springfox_spring_web_2_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_springfox_springfox_swagger2_2_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_springfox_springfox_swagger_common_2_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_springfox_springfox_swagger_ui_2_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_swagger_swagger_annotations_1_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_swagger_swagger_models_1_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_annotation_javax_annotation_api_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_inject_javax_inject_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_validation_validation_api_1_1_0_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_ws_rs_javax_ws_rs_api_2_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__joda_time_joda_time_2_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__junit_junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__log4j_log4j_1_2_17.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_java_dev_javacc_javacc_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_lang3_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_pool2_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_3_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_3_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_8_0_23.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_8_0_23.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_logging_juli_8_0_23.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_0_23.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_zookeeper_zookeeper_3_5_0_alpha.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_aspectj_aspectjrt_1_8_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_aspectj_aspectjweaver_1_8_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_class_model_2_4_0_b06.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_config_types_2_4_0_b06.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_core_2_4_0_b06.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_external_aopalliance_repackaged_2_4_0_b31.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_external_asm_all_repackaged_2_4_0_b06.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_external_bean_validator_2_4_0_b06.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_external_javax_inject_2_4_0_b31.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_hk2_2_4_0_b06.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_hk2_api_2_4_0_b31.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_hk2_config_2_4_0_b06.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_hk2_locator_2_4_0_b31.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_hk2_runlevel_2_4_0_b06.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_hk2_utils_2_4_0_b31.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_osgi_resource_locator_1_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_hk2_spring_bridge_2_4_0_b06.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_jersey_bundles_repackaged_jersey_guava_2_21.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_jersey_containers_jersey_container_servlet_2_14.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_jersey_containers_jersey_container_servlet_core_2_14.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_jersey_core_jersey_client_2_21.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_jersey_core_jersey_common_2_21.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_jersey_core_jersey_server_2_14.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_jersey_ext_jersey_bean_validation_2_14.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_jersey_ext_jersey_spring3_2_14.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_glassfish_jersey_media_jersey_media_json_jackson_2_14.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hamcrest_hamcrest_library_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hibernate_hibernate_validator_5_1_3_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_immutables_value_2_0_16.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_javassist_javassist_3_18_1_GA.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_1_3_GA.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_jvnet_tiger_types_1_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mapstruct_mapstruct_1_0_0_Beta4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mockito_mockito_core_1_10_19.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mongodb_mongo_java_driver_2_12_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_objenesis_objenesis_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_log4j_over_slf4j_1_7_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_slf4j_log4j12_1_7_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_amqp_spring_amqp_1_4_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_amqp_spring_rabbit_1_4_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_1_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_actuator_1_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_1_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_1_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_actuator_1_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_amqp_1_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_aop_1_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_data_mongodb_1_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jersey_1_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_1_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_redis_1_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_1_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_1_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_1_2_4_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_data_spring_data_commons_1_9_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_data_spring_data_mongodb_1_6_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_data_spring_data_redis_1_4_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_hateoas_spring_hateoas_0_16_0_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_plugin_spring_plugin_core_1_1_0_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_plugin_spring_plugin_metadata_1_2_0_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_retry_spring_retry_1_1_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_aop_4_1_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_beans_4_1_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_4_1_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_support_4_1_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_core_4_1_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_expression_4_1_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_messaging_4_1_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_test_4_1_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_tx_4_1_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_web_4_1_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_webmvc_4_1_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_yaml_snakeyaml_1_14.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__redis_clients_jedis_2_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 1.7 31 | 32 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | springboot 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/main/resources/validator.properties=UTF-8 5 | encoding//src/test/java=UTF-8 6 | encoding/=UTF-8 7 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 3 | org.eclipse.jdt.core.compiler.compliance=1.7 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.7 6 | -------------------------------------------------------------------------------- /.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/amqp/Receive.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.amqp; 2 | 3 | /** 4 | * 消费 5 | * 6 | * @author lkl 7 | * @version $Id: Receive.java, v 0.1 2015年8月2日 下午3:02:07 lkl Exp $ 8 | */ 9 | public class Receive { 10 | 11 | //SimpleMessageListenerContainer 引入该类即可 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/amqp/Send.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.amqp; 2 | 3 | import java.util.UUID; 4 | 5 | import org.springframework.amqp.rabbit.core.RabbitTemplate; 6 | import org.springframework.amqp.rabbit.support.CorrelationData; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Component; 9 | 10 | /** 11 | * 生产者 12 | * 13 | * @author lkl 14 | * @version $Id: Send.java, v 0.1 2015年8月2日 下午2:46:57 lkl Exp $ 15 | */ 16 | @Component 17 | public class Send implements RabbitTemplate.ConfirmCallback { 18 | 19 | private RabbitTemplate rabbitTemplate; 20 | 21 | /** 22 | * 构造方法注入 23 | */ 24 | @Autowired 25 | public Send(RabbitTemplate rabbitTemplate) { 26 | this.rabbitTemplate = rabbitTemplate; 27 | rabbitTemplate.setConfirmCallback(this); //rabbitTemplate如果为单利的话,那回调就是最后设置的内容 28 | } 29 | 30 | public void sendMsg(String content) { 31 | CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString()); 32 | rabbitTemplate.convertAndSend(AmqpConfig.EXCHANGE, AmqpConfig.ROUTINGKEY, content, correlationId); 33 | } 34 | 35 | /** 36 | * 回调 37 | */ 38 | @Override 39 | public void confirm(CorrelationData correlationData, boolean ack, String cause) { 40 | System.out.println(" 回调id:" + correlationData); 41 | if (ack) { 42 | System.out.println("消息成功消费"); 43 | } else { 44 | System.out.println("消息消费失败:" + cause); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/annotation/NoAuth.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 无需授权 10 | * 11 | * @author lkl 12 | * @version $Id: NoAuth.java, v 0.1 2015年7月29日 下午11:15:11 lkl Exp $ 13 | */ 14 | @Target(ElementType.METHOD) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | public @interface NoAuth { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/aop/ServiceMonitor.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.aop; 2 | 3 | import org.aspectj.lang.JoinPoint; 4 | import org.aspectj.lang.ProceedingJoinPoint; 5 | import org.aspectj.lang.annotation.After; 6 | import org.aspectj.lang.annotation.AfterReturning; 7 | import org.aspectj.lang.annotation.AfterThrowing; 8 | import org.aspectj.lang.annotation.Around; 9 | import org.aspectj.lang.annotation.Before; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | import org.springframework.stereotype.Component; 13 | 14 | /** 15 | * 服务监控 16 | * aop 添加jar 17 | * 18 | org.springframework.boot 19 | spring-boot-starter-aop 20 | 21 | 22 | * @author lkl 23 | * @version $Id: ServiceMonitor.java, v 0.1 2015年8月5日 上午11:18:22 lkl Exp $ 24 | */ 25 | //@Aspect 26 | @Component 27 | public class ServiceMonitor { 28 | 29 | private Logger log = LoggerFactory.getLogger(ServiceMonitor.class); 30 | 31 | // @Pointcut("execution(* *..service*..*(..))") 32 | // @Pointcut("execution(* com.u51.lkl.springboot.service..*Service.*(..))") 33 | public void pointcut() { 34 | } 35 | 36 | @Before("pointcut()") 37 | public void before(JoinPoint jp) { 38 | log.info("-----前置通知 start-----"); 39 | log.info("jp.getSignature().getDeclaringTypeName():{}", jp.getSignature().getDeclaringTypeName()); 40 | log.info("methodName:" + jp.getSignature().getName()); 41 | log.info(jp.getArgs() != null ? jp.getArgs().toString() : ""); 42 | log.info(jp.getTarget().toString()); 43 | log.info("-----前置通知 end-----"); 44 | } 45 | 46 | @After("pointcut()") 47 | public void after(JoinPoint jp) { 48 | log.info("----after----"); 49 | } 50 | 51 | @AfterReturning("pointcut()") 52 | public void afterReturning(JoinPoint point, Object returnValue) { 53 | log.info("-----@AfterReturning-----" + returnValue); 54 | } 55 | 56 | @Around("pointcut()") 57 | public void around(ProceedingJoinPoint point) { 58 | try { 59 | System.out.println("-----around-start-----"); 60 | point.proceed(); 61 | System.out.println("-----around-end-----"); 62 | } catch (Throwable e) { 63 | e.printStackTrace(); 64 | } 65 | 66 | } 67 | 68 | @AfterThrowing("pointcut()") 69 | public void afterThrowing() { 70 | 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/asm/LoadAnnotationMetadata.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.asm; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.IOException; 6 | import java.io.InputStream; 7 | 8 | import org.junit.Test; 9 | import org.springframework.asm.ClassReader; 10 | import org.springframework.core.type.AnnotationMetadata; 11 | import org.springframework.core.type.ClassMetadata; 12 | import org.springframework.core.type.classreading.AnnotationMetadataReadingVisitor; 13 | 14 | /** 15 | * 测试asm加载Class,在扫描BeanDefinition时获取class信息 16 | * 17 | * @author liaokailin 18 | * @version $Id: LoadAnnotationMetadata.java, v 0.1 2016年7月29日 下午2:03:32 liaokailin Exp $ 19 | */ 20 | public class LoadAnnotationMetadata { 21 | 22 | /** 23 | * App.class 24 | * public class App { 25 | public static void main(String[] args) { 26 | System.out.println("Hello World!"); 27 | } 28 | 29 | @Deprecated 30 | public void hello() { 31 | 32 | } 33 | } 34 | * 35 | * @throws IOException 36 | */ 37 | @Test 38 | public void testAsm() throws IOException { 39 | InputStream is = new FileInputStream(new File( 40 | "/Users/liaokailin/code/github/jvm/target/classes/com/lkl/services/jvm/App.class")); 41 | ClassReader classReader = new ClassReader(is); //使用asm处理扫描的Class文件 42 | ClassLoader classLoader = LoadAnnotationMetadata.class.getClassLoader(); 43 | AnnotationMetadataReadingVisitor visitor = new AnnotationMetadataReadingVisitor(classLoader); 44 | classReader.accept(visitor, ClassReader.SKIP_DEBUG); 45 | ClassMetadata classMetadata = visitor; 46 | AnnotationMetadata annotationMetadata = visitor; 47 | System.out.println(classMetadata.getClassName()); 48 | System.out.println(annotationMetadata.hasAnnotatedMethods("java.lang.Deprecated")); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/async/AsynConfig.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.async; 2 | 3 | import java.lang.reflect.Method; 4 | import java.util.concurrent.Executor; 5 | 6 | import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; 7 | import org.springframework.scheduling.annotation.AsyncConfigurer; 8 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 9 | 10 | /** 11 | * 异步调度,启动下面两个注解 12 | * {@link AsyncSchedulConfig} 13 | * 14 | * @author lkl 15 | * @version $Id: AsynConfig.java, v 0.1 2015年7月29日 下午2:17:56 lkl Exp $ 16 | */ 17 | //@Configuration 18 | //@EnableAsync 19 | public class AsynConfig implements AsyncConfigurer { 20 | @Override 21 | public Executor getAsyncExecutor() { 22 | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); 23 | executor.setCorePoolSize(1); 24 | executor.setMaxPoolSize(Runtime.getRuntime().availableProcessors() * 2); 25 | executor.setQueueCapacity(10); 26 | executor.setThreadNamePrefix("MyExecutor-"); 27 | executor.initialize(); 28 | return executor; 29 | } 30 | 31 | @Override 32 | public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() { 33 | return new AsyncUncaughtExceptionHandler() { 34 | 35 | @Override 36 | public void handleUncaughtException(Throwable ex, Method method, Object... params) { 37 | System.out.println("method:" + method.getName() + ";ex:" + ex.getMessage()); 38 | } 39 | 40 | }; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/async/AsyncCall.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.async; 2 | 3 | import org.springframework.scheduling.annotation.Async; 4 | import org.springframework.stereotype.Component; 5 | 6 | /** 7 | * 异步调用 @EnableAsync 8 | * 定时调度:@EnableScheduling 9 | * @author lkl 10 | * @version $Id: AsynCall.java, v 0.1 2015年7月29日 上午11:30:32 lkl Exp $ 11 | */ 12 | @Component 13 | public class AsyncCall { 14 | 15 | @Async 16 | public void asyncMethod() { 17 | System.out.println("--- asyn method start--"); 18 | try { 19 | Thread.sleep(2000); 20 | } catch (InterruptedException e) { 21 | e.printStackTrace(); 22 | } 23 | System.out.println("--- asyn method end--"); 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/async/AsyncSchedulConfig.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.async; 2 | 3 | import java.lang.Thread.UncaughtExceptionHandler; 4 | import java.util.concurrent.Executor; 5 | 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.scheduling.annotation.EnableAsync; 9 | import org.springframework.scheduling.annotation.EnableScheduling; 10 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 11 | 12 | import com.lkl.springboot.async.AsynConfig; 13 | import com.lkl.springboot.async.schedul.SchedulConfig; 14 | 15 | /** 16 | * 同时配置定时调度和异步调度 17 | * 单独配置定时调度 {@link SchedulConfig} 18 | * 单独配置异步调度 {@link AsynConfig} 19 | * @author lkl 20 | * @version $Id: AsyncSchedulConfig.java, v 0.1 2015年7月29日 下午2:16:59 lkl Exp $ 21 | */ 22 | @Configuration 23 | @EnableAsync 24 | @EnableScheduling 25 | public class AsyncSchedulConfig implements UncaughtExceptionHandler { 26 | 27 | @Override 28 | public void uncaughtException(Thread t, Throwable e) { 29 | System.out.println("threadName:" + t.getName() + ";e:" + e.getMessage()); 30 | } 31 | 32 | @Bean 33 | public Executor threadPoolTaskExecutor() { 34 | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); 35 | executor.setCorePoolSize(1); 36 | executor.setMaxPoolSize(Runtime.getRuntime().availableProcessors() * 2); 37 | executor.setQueueCapacity(10); 38 | executor.setThreadNamePrefix("MyExecutor-"); 39 | executor.initialize(); 40 | return executor; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/async/schedul/SchedulCall.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.async.schedul; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | /** 6 | * 定时调度,无需方法调用 7 | * 8 | * @author lkl 9 | * @version $Id: SchedulCall.java, v 0.1 2015年7月29日 下午2:00:49 lkl Exp $ 10 | */ 11 | @Component 12 | public class SchedulCall { 13 | 14 | // @Scheduled(fixedRate = 1000) 15 | public void schedulMethod() { 16 | System.out.println("---schedulMethod at fixedRate 1000"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/async/schedul/SchedulConfig.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.async.schedul; 2 | 3 | import java.util.concurrent.Executor; 4 | import java.util.concurrent.Executors; 5 | 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.scheduling.annotation.SchedulingConfigurer; 8 | import org.springframework.scheduling.config.ScheduledTaskRegistrar; 9 | 10 | import com.lkl.springboot.async.AsyncSchedulConfig; 11 | 12 | /** 13 | * 定时调度,启动下面的两个注解 14 | * {@link AsyncSchedulConfig} 15 | * 16 | * @author lkl 17 | * @version $Id: SchedulConfig.java, v 0.1 2015年7月29日 下午2:18:32 lkl Exp $ 18 | */ 19 | //@Configuration 20 | //@EnableScheduling 21 | public class SchedulConfig implements SchedulingConfigurer { 22 | 23 | @Override 24 | public void configureTasks(ScheduledTaskRegistrar taskRegistrar) { 25 | taskRegistrar.setScheduler(taskExecutor()); 26 | } 27 | 28 | @Bean(destroyMethod = "shutdown") 29 | public Executor taskExecutor() { 30 | return Executors.newScheduledThreadPool(100); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/clr/MyCommandLineRunner01.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.clr; 2 | 3 | import org.springframework.boot.CommandLineRunner; 4 | import org.springframework.core.Ordered; 5 | import org.springframework.core.annotation.Order; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | @Order(Ordered.LOWEST_PRECEDENCE) 10 | public class MyCommandLineRunner01 implements CommandLineRunner { 11 | 12 | @Override 13 | public void run(String... args) throws Exception { 14 | System.out.println("MyCommandLineRunner01"); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/clr/MyCommandLineRunner02.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.clr; 2 | 3 | import org.springframework.boot.CommandLineRunner; 4 | import org.springframework.core.Ordered; 5 | import org.springframework.core.annotation.Order; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * 多CommandLineRunner实现,可通过Order指定执行顺序 10 | * 11 | * @author lkl 12 | * @version $Id: MyCommandLineRunner02.java, v 0.1 2015年7月27日 下午8:30:52 lkl Exp $ 13 | */ 14 | @Component 15 | @Order(Ordered.HIGHEST_PRECEDENCE) 16 | public class MyCommandLineRunner02 implements CommandLineRunner { 17 | 18 | @Override 19 | public void run(String... args) throws Exception { 20 | System.out.println("MyCommandLineRunner02"); 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/config/AppConfig.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.config; 2 | 3 | import org.springframework.boot.autoconfigure.web.ServerProperties; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * 9 | * @ConfigurationProperties 中的 ignoreUnknownFields =false时,如果前缀prefix中数据没在属性中申明完整的话,则抛出异常,默认为true 10 | * 可参考 {@link ServerProperties}设置 tomcat的参数 11 | * @author lkl 12 | * @version $Id: AppConfig.java, v 0.1 2015年7月27日 下午10:59:13 lkl Exp $ 13 | */ 14 | @Component 15 | @ConfigurationProperties(prefix = "environments", ignoreUnknownFields = true) 16 | public class AppConfig { 17 | 18 | private String url; 19 | 20 | private String name; 21 | 22 | private InnerClass innerClass = new InnerClass(); //innerClass 属性名称和类名保持一致 23 | 24 | static class InnerClass { 25 | String className; 26 | 27 | public String getClassName() { 28 | return className; 29 | } 30 | 31 | public void setClassName(String className) { 32 | this.className = className; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return "InnerClass [className=" + className + "]"; 38 | } 39 | 40 | } 41 | 42 | public String getName() { 43 | return name; 44 | } 45 | 46 | public void setName(String name) { 47 | this.name = name; 48 | } 49 | 50 | public String getUrl() { 51 | return url; 52 | } 53 | 54 | public void setUrl(String url) { 55 | this.url = url; 56 | } 57 | 58 | public InnerClass getInnerClass() { 59 | return innerClass; 60 | } 61 | 62 | public void setInnerClass(InnerClass innerClass) { 63 | this.innerClass = innerClass; 64 | } 65 | 66 | @Override 67 | public String toString() { 68 | return "AppConfig [url=" + url + ", name=" + name + ", ic=" + innerClass + "]"; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/config/AppConfig2.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.config; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | @ConfigurationProperties(prefix = "application") 8 | public class AppConfig2 { 9 | String name; 10 | String version; 11 | 12 | public String getName() { 13 | return name; 14 | } 15 | 16 | public void setName(String name) { 17 | this.name = name; 18 | } 19 | 20 | public String getVersion() { 21 | return version; 22 | } 23 | 24 | public void setVersion(String version) { 25 | this.version = version; 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | return "ApplicationProperties [name=" + name + ", version=" + version + "]"; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/config/AppConfig3.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.config; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.springframework.boot.context.properties.ConfigurationProperties; 7 | import org.springframework.stereotype.Component; 8 | 9 | @Component 10 | @ConfigurationProperties(prefix = "my") 11 | public class AppConfig3 { 12 | 13 | private List servers = new ArrayList(); 14 | 15 | public List getServers() { 16 | return this.servers; 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return "AppConfig3 [servers=" + servers + "]"; 22 | } 23 | 24 | public void setServers(List servers) { 25 | this.servers = servers; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/config/MyConfig.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.config; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | 6 | import com.lkl.springboot.config.AppConfig; 7 | import com.lkl.springboot.config.AppConfig2; 8 | import com.lkl.springboot.config.AppConfig3; 9 | 10 | @Component 11 | public class MyConfig { 12 | 13 | @Autowired 14 | private AppConfig3 appConfig3; 15 | 16 | @Autowired 17 | private AppConfig2 appConfig2; 18 | 19 | @Autowired 20 | private AppConfig appConfig; 21 | 22 | public void showAppConfig() { 23 | System.out.println("appConfig:" + appConfig); 24 | System.out.println("appConfig2:" + appConfig2); 25 | System.out.println("appConfig3:" + appConfig3); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/consul/ConsulDemo.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.consul; 2 | 3 | import java.text.ParseException; 4 | import java.text.SimpleDateFormat; 5 | import java.util.Date; 6 | import java.util.Timer; 7 | import java.util.TimerTask; 8 | 9 | import com.orbitz.consul.AgentClient; 10 | import com.orbitz.consul.Consul; 11 | import com.orbitz.consul.NotRegisteredException; 12 | 13 | public class ConsulDemo { 14 | 15 | public static void main(String[] args) throws NotRegisteredException { 16 | Consul consul = Consul.newClient("localhost", 8500); // connect to Consul on localhost 17 | final AgentClient agentClient = consul.agentClient(); 18 | 19 | String serviceName = "MyService"; 20 | final String serviceId = "1"; 21 | 22 | agentClient.register(8080, 3L, serviceName, serviceId); // registers with a TTL of 3 seconds 23 | agentClient.pass(serviceId); // check in with Consul, serviceId required only. client will prepend "service:" for service level checks. 24 | Timer timer = new Timer(); 25 | final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 26 | timer.scheduleAtFixedRate(new TimerTask() { 27 | 28 | @Override 29 | public void run() { 30 | try { 31 | if (new Date().before(sdf.parse("2015-09-01 16:57:00"))) { 32 | agentClient.pass(serviceId, "it's ok " + new Date()); 33 | System.out.println("it's ok " + new Date()); 34 | } else { 35 | agentClient.fail("it's fail " + new Date()); 36 | } 37 | 38 | } catch (NotRegisteredException e) { 39 | System.out.println("----fail----"); 40 | } catch (ParseException e) { 41 | // TODO Auto-generated catch block 42 | e.printStackTrace(); 43 | } 44 | } 45 | }, 3000, 2000); 46 | 47 | } 48 | } -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/consul/ConsulSession.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.consul; 2 | 3 | import com.google.common.base.Optional; 4 | import com.orbitz.consul.Consul; 5 | import com.orbitz.consul.KeyValueClient; 6 | import com.orbitz.consul.NotRegisteredException; 7 | import com.orbitz.consul.SessionClient; 8 | 9 | public class ConsulSession { 10 | 11 | public static void main(String[] args) throws NotRegisteredException { 12 | Consul consul = Consul.newClient("localhost", 8500); // connect to Consul on localhost 13 | SessionClient session = consul.sessionClient(); 14 | 15 | KeyValueClient kv = consul.keyValueClient(); 16 | // kv.releaseLock(key, sessionId) 17 | // System.out.println(kv.acquireLock("hello", "91b33042-c9ff-5e95-bdf7-9562e21e9e3b")); 18 | Optional os = kv.getSession("hello"); 19 | } 20 | } -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/controller/ZipkinController.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.controller; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | @RestController 9 | public class ZipkinController { 10 | 11 | @RequestMapping(value = "/zipkin") 12 | public String zipkin() throws InterruptedException { 13 | TimeUnit.SECONDS.sleep(4); 14 | System.out.println("hello zipkin."); 15 | return "hello zipkin"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/domain/Order.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.domain; 2 | 3 | import javax.validation.constraints.Min; 4 | import javax.validation.constraints.NotNull; 5 | 6 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 7 | 8 | /** 9 | * 订单实体 10 | * 11 | * @author lkl 12 | * @version $Id: Order.java, v 0.1 2015年7月29日 下午2:28:48 lkl Exp $ 13 | */ 14 | @JsonSerialize 15 | public class Order { 16 | 17 | @NotNull 18 | private String orderId; 19 | @Min(1) 20 | private Integer total; 21 | 22 | private String address; 23 | private String customerName; 24 | 25 | public String getOrderId() { 26 | return orderId; 27 | } 28 | 29 | public void setOrderId(String orderId) { 30 | this.orderId = orderId; 31 | } 32 | 33 | public Integer getTotal() { 34 | return total; 35 | } 36 | 37 | public void setTotal(Integer total) { 38 | this.total = total; 39 | } 40 | 41 | public String getAddress() { 42 | return address; 43 | } 44 | 45 | public void setAddress(String address) { 46 | this.address = address; 47 | } 48 | 49 | public String getCustomerName() { 50 | return customerName; 51 | } 52 | 53 | public void setCustomerName(String customerName) { 54 | this.customerName = customerName; 55 | } 56 | 57 | @Override 58 | public String toString() { 59 | return "Order [orderId=" + orderId + ", total=" + total + ", address=" + address + ", customerName=" 60 | + customerName + "]"; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/domain/Person.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.domain; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | 6 | import org.springframework.data.annotation.Id; 7 | 8 | @ApiModel("人员信息实体") 9 | public class Person { 10 | 11 | @ApiModelProperty("人员ID") 12 | @Id 13 | private String id; 14 | @ApiModelProperty("人员名称") 15 | private String name; 16 | @ApiModelProperty("人员年龄") 17 | private Integer age; 18 | 19 | public String getId() { 20 | return id; 21 | } 22 | 23 | public void setId(String id) { 24 | this.id = id; 25 | } 26 | 27 | public String getName() { 28 | return name; 29 | } 30 | 31 | public void setName(String name) { 32 | this.name = name; 33 | } 34 | 35 | public Integer getAge() { 36 | return age; 37 | } 38 | 39 | public void setAge(Integer age) { 40 | this.age = age; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return "Person [id=" + id + ", name=" + name + ", age=" + age + "]"; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/domain/User.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.domain; 2 | 3 | import java.util.Date; 4 | 5 | import org.springframework.beans.factory.annotation.Value; 6 | import org.springframework.context.annotation.PropertySource; 7 | import org.springframework.stereotype.Component; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 11 | import com.fasterxml.jackson.annotation.JsonInclude; 12 | import com.fasterxml.jackson.annotation.JsonInclude.Include; 13 | import com.fasterxml.jackson.annotation.JsonProperty; 14 | import com.fasterxml.jackson.annotation.JsonPropertyOrder; 15 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 16 | 17 | @PropertySource("application.properties") 18 | @Component 19 | @JsonIgnoreProperties({ "age" }) 20 | @JsonSerialize() 21 | @JsonInclude(Include.NON_NULL) 22 | //不在推荐 @JsonSerialize(include = Inclusion.NON_NULL) 使用@JsonInclude(Include.NON_NULL) 23 | public class User { 24 | 25 | // @Value("${hit:liaokailin}") 26 | //调用 application.yml中的配置,内部通过YamlPropertySourceLoader加载信息 27 | @Value("${application.name}") 28 | @JsonProperty("name") 29 | @JsonPropertyOrder({ "1" }) 30 | private String userName; 31 | @Value("${my.number:25}") 32 | private Integer age; 33 | private String remark; 34 | @JsonFormat(pattern = "yyyy-MM-dd") 35 | private Date birthday; 36 | 37 | public String getRemark() { 38 | return remark; 39 | } 40 | 41 | public void setRemark(String remark) { 42 | this.remark = remark; 43 | } 44 | 45 | public Date getBirthday() { 46 | return birthday; 47 | } 48 | 49 | public void setBirthday(Date birthday) { 50 | this.birthday = birthday; 51 | } 52 | 53 | public Integer getAge() { 54 | return age; 55 | } 56 | 57 | public void setAge(Integer age) { 58 | this.age = age; 59 | } 60 | 61 | public String getUserName() { 62 | return userName; 63 | } 64 | 65 | public void setUserName(String userName) { 66 | this.userName = userName; 67 | } 68 | 69 | @Override 70 | public String toString() { 71 | return "User [userName=" + userName + ", age=" + age + "]"; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/endpoint/AllEndPoint.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.endpoint; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.actuate.endpoint.AbstractEndpoint; 7 | import org.springframework.boot.actuate.endpoint.Endpoint; 8 | import org.springframework.stereotype.Component; 9 | 10 | @Component 11 | @SuppressWarnings("rawtypes") 12 | public class AllEndPoint extends AbstractEndpoint> { 13 | 14 | private List endpoints; 15 | 16 | @Autowired 17 | public AllEndPoint(List endpoints) { 18 | super("points", false); 19 | this.endpoints = endpoints; 20 | } 21 | 22 | public List invoke() { 23 | return this.endpoints; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/endpoint/CusEndPoint.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.endpoint; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.boot.actuate.endpoint.Endpoint; 6 | import org.springframework.stereotype.Component; 7 | 8 | import com.google.common.collect.Lists; 9 | 10 | /** 11 | * 自定义端点 12 | * 13 | * @author lkl 14 | * @version $Id: CusEndPoint.java, v 0.1 2015年8月12日 下午8:10:16 lkl Exp $ 15 | */ 16 | @Component 17 | public class CusEndPoint implements Endpoint> { 18 | 19 | /** 20 | * 端点id 21 | */ 22 | @Override 23 | public String getId() { 24 | return "person"; 25 | } 26 | 27 | /** 28 | * 是否可用 29 | */ 30 | @Override 31 | public boolean isEnabled() { 32 | return true; 33 | } 34 | 35 | /** 36 | * 是否敏感数据 37 | */ 38 | @Override 39 | public boolean isSensitive() { 40 | return false; 41 | } 42 | 43 | /** 44 | * 返回该端点结果集 45 | * @see org.springframework.boot.actuate.endpoint.Endpoint#invoke() 46 | */ 47 | @Override 48 | public List invoke() { 49 | List list = Lists.newArrayList("liaokailin", "25"); 50 | return list; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/exception/RestException.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.exception; 2 | 3 | public class RestException extends RuntimeException { 4 | 5 | /** */ 6 | private static final long serialVersionUID = 9061481993630020292L; 7 | 8 | public RestException(String message) { 9 | super(message); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/exception/handler/MyExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.exception.handler; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | import javax.servlet.http.HttpServletResponse; 5 | 6 | import org.springframework.web.bind.annotation.ExceptionHandler; 7 | 8 | /** 9 | * 异常处理策略 作为父类,让controller继承 10 | * 11 | * @author lkl 12 | * @version $Id: MyExceptionHandler.java, v 0.1 2015年7月28日 下午10:35:21 lkl Exp $ 13 | */ 14 | public class MyExceptionHandler { 15 | 16 | @ExceptionHandler(RuntimeException.class) 17 | public void handleRunTimeException(RuntimeException r, HttpServletRequest request, HttpServletResponse response) { 18 | System.out.println(" request.getContentType():" + request.getContentType()); 19 | System.out.println(" response.getStatus():" + response.getStatus()); 20 | System.out.println(" MyExceptionHandler:" + r.getMessage()); 21 | // return "some error"; 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/filter/TestFileter.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.filter; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.Filter; 6 | import javax.servlet.FilterChain; 7 | import javax.servlet.FilterConfig; 8 | import javax.servlet.ServletException; 9 | import javax.servlet.ServletRequest; 10 | import javax.servlet.ServletResponse; 11 | 12 | //@Component 13 | public class TestFileter implements Filter { 14 | 15 | @Override 16 | public void init(FilterConfig filterConfig) throws ServletException { 17 | System.out.println("----"); 18 | } 19 | 20 | @Override 21 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, 22 | ServletException { 23 | System.out.println("--1122--"); 24 | chain.doFilter(request, response); 25 | // TODO Auto-generated method stub 26 | 27 | } 28 | 29 | @Override 30 | public void destroy() { 31 | // TODO Auto-generated method stub 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/health/MyHealthCheck.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.health; 2 | 3 | import org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration; 4 | import org.springframework.boot.actuate.health.Health; 5 | import org.springframework.boot.actuate.health.HealthIndicator; 6 | import org.springframework.boot.actuate.health.RabbitHealthIndicator; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * 自定义健康指示器 11 | * 如果在project中存在rabbitmq的jar包,但是rabbitmq服务器没启,在启动时候会调用 {@link RabbitHealthIndicator} 12 | * 类去校验rabbitmq信息,会抛出异常,在配置文件中应该去掉rabbit的健康检查 13 | * management.health.rabbit.enabled=false 14 | * 详细类见:{@link HealthIndicatorAutoConfiguration} 15 | * 16 | * @author lkl 17 | * @version $Id: MyHealthCheck.java, v 0.1 2015年8月12日 下午7:19:46 lkl Exp $ 18 | */ 19 | @Component 20 | public class MyHealthCheck implements HealthIndicator { 21 | @Override 22 | public Health health() { 23 | int errorCode = check(); // perform some specific health check 24 | if (errorCode != 0) { 25 | return Health.down().withDetail("Error Code", errorCode).build(); 26 | } 27 | return Health.up().build(); 28 | } 29 | 30 | public int check() { 31 | return 0; 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/hystrix/CommandHelloWorld01.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.hystrix; 2 | 3 | import rx.Observable; 4 | import rx.functions.Action1; 5 | 6 | import com.netflix.hystrix.HystrixCommand; 7 | import com.netflix.hystrix.HystrixCommandGroupKey; 8 | 9 | public class CommandHelloWorld01 extends HystrixCommand { 10 | private String name; 11 | 12 | public CommandHelloWorld01(String name) { 13 | super(HystrixCommandGroupKey.Factory.asKey("ExampleGroup")); 14 | this.name = name; 15 | } 16 | 17 | @Override 18 | protected String run() throws Exception { 19 | return "hello" + name; 20 | } 21 | 22 | public static void main(String[] args) { 23 | 24 | String s = new CommandHelloWorld01("Bob").execute(); 25 | System.out.println(s); 26 | // Future s = new CommandHelloWorld("Bob").queue(); 27 | Observable obs = new CommandHelloWorld01("Bob").observe(); //RxJava 28 | obs.subscribe(new Action1() { 29 | 30 | @Override 31 | public void call(String t) { 32 | System.out.println(t); 33 | } 34 | }); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/hystrix/CommandWithFallbackViaNetwork.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.hystrix; 2 | 3 | import com.netflix.hystrix.HystrixCommand; 4 | import com.netflix.hystrix.HystrixCommandGroupKey; 5 | import com.netflix.hystrix.HystrixCommandKey; 6 | import com.netflix.hystrix.HystrixThreadPoolKey; 7 | 8 | public class CommandWithFallbackViaNetwork extends HystrixCommand { 9 | private final int id; 10 | 11 | protected CommandWithFallbackViaNetwork(int id) { 12 | super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("RemoteServiceX")).andCommandKey( 13 | HystrixCommandKey.Factory.asKey("GetValueCommand"))); 14 | this.id = id; 15 | } 16 | 17 | @Override 18 | protected String run() { 19 | // RemoteService.getValue(id); 20 | throw new RuntimeException("force failure for example"); 21 | } 22 | 23 | @Override 24 | protected String getFallback() { 25 | return new FallbackViaNetwork(id).execute(); 26 | } 27 | 28 | private static class FallbackViaNetwork extends HystrixCommand { 29 | private final int id; 30 | 31 | public FallbackViaNetwork(int id) { 32 | super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("RemoteServiceX")) 33 | .andCommandKey(HystrixCommandKey.Factory.asKey("GetValueFallbackCommand")) 34 | // 使用不同的线程池做隔离,防止上层线程池跑满,影响降级逻辑. 35 | .andThreadPoolKey(HystrixThreadPoolKey.Factory.asKey("RemoteServiceXFallback"))); 36 | this.id = id; 37 | } 38 | 39 | @Override 40 | protected String run() { 41 | //return MemCacheClient.getValue(id); 42 | return ""; 43 | } 44 | 45 | @Override 46 | protected String getFallback() { 47 | return null; 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/hystrix/HelloWorldCommand02.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.hystrix; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import com.netflix.hystrix.HystrixCommand; 6 | import com.netflix.hystrix.HystrixCommandGroupKey; 7 | import com.netflix.hystrix.HystrixCommandProperties; 8 | 9 | //重载HystrixCommand 的getFallback方法实现逻辑 10 | public class HelloWorldCommand02 extends HystrixCommand { 11 | private final String name; 12 | 13 | public HelloWorldCommand02(String name) { 14 | super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("HelloWorldGroup")) 15 | /* 配置依赖超时时间,500毫秒*/ 16 | .andCommandPropertiesDefaults(HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(500))); 17 | this.name = name; 18 | } 19 | 20 | @Override 21 | protected String getFallback() { 22 | return "exeucute Falled"; 23 | } 24 | 25 | /** 26 | * 前面设置500ms超时,当这里修改1000ms后,则会执行getFallback()方法 27 | * 28 | * 除了HystrixBadRequestException异常之外,所有从run()方法抛出的异常都算作失败,并触发降级getFallback()和断路器逻辑。 29 | HystrixBadRequestException用在非法参数或非系统故障异常等不应触发回退逻辑的场景 30 | */ 31 | @Override 32 | protected String run() throws Exception { 33 | //sleep 1 秒,调用会超时 34 | TimeUnit.MILLISECONDS.sleep(1000); 35 | return "Hello " + name + " thread:" + Thread.currentThread().getName(); 36 | } 37 | 38 | public static void main(String[] args) throws Exception { 39 | HelloWorldCommand02 command = new HelloWorldCommand02("test-Fallback"); 40 | String result = command.execute(); 41 | System.out.println(result); 42 | } 43 | } 44 | /* 运行结果:getFallback() 调用运行 45 | getFallback executed 46 | */ -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/hystrix/HystrixConfig.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.hystrix; 2 | 3 | import org.springframework.boot.context.embedded.ServletRegistrationBean; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet; 8 | 9 | /** 10 | * http://localhost:8080/hystrix.stream 11 | * 12 | * @author liaokailin 13 | * @version $Id: HystrixConfig.java, v 0.1 2015年11月5日 下午6:45:47 liaokailin Exp $ 14 | */ 15 | @Configuration 16 | public class HystrixConfig { 17 | 18 | @Bean 19 | public HystrixMetricsStreamServlet getHystrixMetricsStreamServlet() { 20 | return new HystrixMetricsStreamServlet(); 21 | } 22 | 23 | @Bean 24 | public ServletRegistrationBean registration(HystrixMetricsStreamServlet filter) { 25 | ServletRegistrationBean registration = new ServletRegistrationBean(filter, new String[0]); 26 | registration.setEnabled(true); 27 | registration.addUrlMappings(new String[] { "/hystrix.stream" }); 28 | return registration; 29 | 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/hystrix/RequestCacheCommand.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.hystrix; 2 | 3 | import com.netflix.hystrix.HystrixCommand; 4 | import com.netflix.hystrix.HystrixCommandGroupKey; 5 | import com.netflix.hystrix.strategy.concurrency.HystrixRequestContext; 6 | 7 | public class RequestCacheCommand extends HystrixCommand { 8 | private final int id; 9 | 10 | public RequestCacheCommand(int id) { 11 | super(HystrixCommandGroupKey.Factory.asKey("RequestCacheCommand")); 12 | this.id = id; 13 | } 14 | 15 | @Override 16 | protected String run() throws Exception { 17 | System.out.println(Thread.currentThread().getName() + " execute id=" + id); 18 | return "executed=" + id; 19 | } 20 | 21 | //重写getCacheKey方法,实现区分不同请求的逻辑 22 | @Override 23 | protected String getCacheKey() { 24 | return String.valueOf(id); 25 | } 26 | 27 | public static void main(String[] args) { 28 | HystrixRequestContext context = HystrixRequestContext.initializeContext(); 29 | try { 30 | RequestCacheCommand command2a = new RequestCacheCommand(2); 31 | RequestCacheCommand command2b = new RequestCacheCommand(2); 32 | System.out.println(command2a.execute()); 33 | //isResponseFromCache判定是否是在缓存中获取结果 34 | System.out.println(command2a.isResponseFromCache()); 35 | 36 | System.out.println(command2b.execute()); 37 | //isResponseFromCache判定是否是在缓存中获取结果 38 | System.out.println(command2b.isResponseFromCache()); 39 | 40 | } finally { 41 | context.shutdown(); 42 | } 43 | context = HystrixRequestContext.initializeContext(); 44 | try { 45 | RequestCacheCommand command3b = new RequestCacheCommand(2); 46 | System.out.println(command3b.execute()); 47 | //isResponseFromCache判定是否是在缓存中获取结果 48 | System.out.println(command3b.isResponseFromCache()); 49 | } finally { 50 | context.shutdown(); 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/hystrix/SemaphoreIsolation.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.hystrix; 2 | 3 | import com.netflix.hystrix.HystrixCommand; 4 | import com.netflix.hystrix.HystrixCommandGroupKey; 5 | import com.netflix.hystrix.HystrixCommandProperties; 6 | 7 | public class SemaphoreIsolation extends HystrixCommand { 8 | private final String name; 9 | 10 | public SemaphoreIsolation(String name) { 11 | super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("HelloWorldGroup")) 12 | /* 配置信号量隔离方式,默认采用线程池隔离 */ 13 | .andCommandPropertiesDefaults( 14 | HystrixCommandProperties.Setter().withExecutionIsolationStrategy( 15 | HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE))); 16 | this.name = name; 17 | } 18 | 19 | @Override 20 | protected String run() throws Exception { 21 | return "HystrixThread:" + Thread.currentThread().getName(); 22 | } 23 | 24 | public static void main(String[] args) throws Exception { 25 | SemaphoreIsolation command = new SemaphoreIsolation("semaphore"); 26 | String result = command.execute(); 27 | System.out.println(result); 28 | System.out.println("MainThread:" + Thread.currentThread().getName()); 29 | } 30 | } 31 | /** 运行结果 32 | HystrixThread:main 33 | MainThread:main 34 | */ 35 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/hystrix/TestCommandCollapsing.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.hystrix; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collection; 5 | import java.util.List; 6 | import java.util.concurrent.ExecutionException; 7 | 8 | import com.netflix.hystrix.HystrixCollapser; 9 | import com.netflix.hystrix.HystrixCommand; 10 | import com.netflix.hystrix.HystrixCommandGroupKey; 11 | import com.netflix.hystrix.HystrixCommandKey; 12 | import com.netflix.hystrix.strategy.concurrency.HystrixRequestContext; 13 | 14 | /** 15 | * 请求合并 16 | */ 17 | public class TestCommandCollapsing extends HystrixCollapser, String, Integer> { 18 | 19 | private final Integer key; 20 | 21 | public TestCommandCollapsing(Integer key) { 22 | this.key = key; 23 | } 24 | 25 | @Override 26 | public Integer getRequestArgument() { 27 | return key; 28 | } 29 | 30 | @Override 31 | protected HystrixCommand> createCommand(Collection> requests) { 32 | 33 | return new BatchCommond(requests); 34 | } 35 | 36 | @Override 37 | protected void mapResponseToRequests(List batchResponse, 38 | Collection> requests) { 39 | int count = 0; 40 | for (CollapsedRequest request : requests) { 41 | request.setResponse(batchResponse.get(count++)); 42 | } 43 | 44 | } 45 | 46 | private final static class BatchCommond extends HystrixCommand> { 47 | private Collection> requests; 48 | 49 | protected BatchCommond(Collection> requests) { 50 | super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("ExampleGroup")).andCommandKey( 51 | HystrixCommandKey.Factory.asKey("GetValueForKey"))); 52 | this.requests = requests; 53 | } 54 | 55 | @Override 56 | protected List run() throws Exception { 57 | ArrayList response = new ArrayList(); 58 | for (CollapsedRequest request : requests) { 59 | // artificial response for each argument received in the batch 60 | response.add("ValueForKey: " + request.getArgument()); 61 | } 62 | return response; 63 | } 64 | 65 | } 66 | 67 | public static void main(String[] args) throws InterruptedException, ExecutionException { 68 | HystrixRequestContext context = HystrixRequestContext.initializeContext(); 69 | System.out.println(new TestCommandCollapsing(1).queue().get()); 70 | context.shutdown(); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/importresource/ImportResourceFoo.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.importresource; 2 | 3 | import org.springframework.context.annotation.AnnotationConfigApplicationContext; 4 | 5 | import com.lkl.springboot.domain.Person; 6 | import com.lkl.springboot.domain.User; 7 | 8 | /** 9 | * 10 | * @ImportResource 导入配置文件 建议使用@ComponentScan 11 | * @author lkl 12 | * @version $Id: ImportResourceFoo.java, v 0.1 2015年7月27日 下午4:09:59 lkl Exp $ 13 | */ 14 | //@Configuration 15 | //@ImportResource(value = "xml_config.xml") 16 | //@ComponentScan("com.u51.lkl.springboot") 17 | public class ImportResourceFoo { 18 | 19 | public static void main1(String[] args) { 20 | AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(ImportResourceFoo.class); 21 | Person p = (Person) ctx.getBean("person"); 22 | System.out.println(p); //Person [name=zhangsan, age=12] 23 | User u = (User) ctx.getBean("user"); 24 | System.out.println(u.getUserName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/lifecycle/MyLifecycle.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.lifecycle; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.context.SmartLifecycle; 6 | import org.springframework.context.support.AbstractApplicationContext; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * 生命周期bean测试 11 | * 实现SmartLifecycle接口,并且 isAutoStartup 设置为true。isRunning 返回为false,在启动时候会调用start 方法 12 | * 具体实现代码见 {@link AbstractApplicationContext#refresh()} 13 | * -> finishRefresh ->initLifecycleProcessor();-> getLifecycleProcessor().onRefresh(); 14 | * 15 | * ++++ getPhase 16 | ++++ getPhase 17 | ++++ isRunning 18 | ++++ start 19 | * 20 | * @author liaokailin 21 | * @version $Id: MyLifecycle.java, v 0.1 2015年10月24日 下午2:51:38 liaokailin Exp $ 22 | */ 23 | @Component 24 | public class MyLifecycle implements SmartLifecycle { 25 | private Logger log = LoggerFactory.getLogger(MyLifecycle.class); 26 | 27 | @Override 28 | public void start() { 29 | log.info("++++ start"); 30 | } 31 | 32 | @Override 33 | public void stop() { 34 | log.info("++++ stop"); 35 | } 36 | 37 | @Override 38 | public boolean isRunning() { 39 | log.info("++++ isRunning"); 40 | return false; 41 | } 42 | 43 | @Override 44 | public int getPhase() { 45 | log.info("++++ getPhase"); 46 | return 0; 47 | } 48 | 49 | @Override 50 | public boolean isAutoStartup() { 51 | return true; 52 | } 53 | 54 | @Override 55 | public void stop(Runnable callback) { 56 | log.info("++++ stop"); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/listener/ApplicationEnvironmentPreparedEventListener.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.listener; 2 | 3 | import java.util.Iterator; 4 | 5 | import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; 6 | import org.springframework.context.ApplicationListener; 7 | import org.springframework.core.env.ConfigurableEnvironment; 8 | import org.springframework.core.env.MutablePropertySources; 9 | import org.springframework.core.env.PropertySource; 10 | 11 | /** 12 | * application环境配置监听 13 | * @author lkl 14 | * @version $Id: ApplicationEnvironmentPreparedEventListener.java, v 0.1 2015年7月27日 下午5:12:29 lkl Exp $ 15 | */ 16 | public class ApplicationEnvironmentPreparedEventListener implements 17 | ApplicationListener { 18 | 19 | @Override 20 | public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) { 21 | System.out.println(" ApplicationEnvironmentPreparedEventListner ====>" + event.getTimestamp()); 22 | ConfigurableEnvironment envi = event.getEnvironment(); 23 | MutablePropertySources mps = envi.getPropertySources(); 24 | if (mps != null) { 25 | Iterator> iter = mps.iterator(); 26 | while (iter.hasNext()) { 27 | PropertySource ps = iter.next(); 28 | if (ps.getName().equals("applicationConfigurationProperties")) { 29 | Object o = ps.getProperty("hit"); 30 | System.out.println("获取资源文件信息:" + o); 31 | } 32 | 33 | System.out.println("ps: ps.getName()==>" + ps.getName() + ";ps.getSource()==>" + ps.getSource() 34 | + "; ps.getClass()==>" + ps.getClass()); 35 | } 36 | } 37 | System.out.println("---------------------------------------"); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/listener/ApplicationFailedEventListener.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.listener; 2 | 3 | import org.springframework.boot.context.event.ApplicationFailedEvent; 4 | import org.springframework.context.ApplicationListener; 5 | 6 | public class ApplicationFailedEventListener implements ApplicationListener { 7 | 8 | @Override 9 | public void onApplicationEvent(ApplicationFailedEvent event) { 10 | System.out.println(" ApplicationFailedEventListener ====>" + event.getTimestamp()); 11 | System.out.println(" event.getException():===>" + event.getException().getMessage()); 12 | System.out.println("---------------------------------------"); 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/listener/ApplicationPreparedEventListener.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.listener; 2 | 3 | import org.springframework.boot.context.event.ApplicationPreparedEvent; 4 | import org.springframework.context.ApplicationContextAware; 5 | import org.springframework.context.ApplicationListener; 6 | import org.springframework.context.ConfigurableApplicationContext; 7 | 8 | /** 9 | * 该监听执行完成时 bean未初始化完成 获取不到所有的bean, 可以采用@PostConstruct(bean肯定初始化完成),或采用 @see {@link ApplicationContextAware} 10 | * 11 | * @author lkl 12 | * @version $Id: ApplicationPreparedEventListener.java, v 0.1 2015年7月27日 下午7:57:25 lkl Exp $ 13 | */ 14 | public class ApplicationPreparedEventListener implements ApplicationListener { 15 | 16 | @Override 17 | public void onApplicationEvent(ApplicationPreparedEvent event) { 18 | System.out.println("ApplicationPreparedEventListner ==>" + event.getTimestamp()); 19 | ConfigurableApplicationContext cac = event.getApplicationContext(); 20 | if (cac != null) { 21 | System.out.println("-----cac.isActive():" + cac.isActive()); 22 | int beanCount = cac.getBeanDefinitionCount(); 23 | System.out.println("-----beanCount : " + beanCount); 24 | 25 | String[] beanNames = cac.getBeanDefinitionNames(); 26 | if (beanNames != null) { 27 | for (String s : beanNames) { 28 | System.out.println("beanName :" + s); 29 | } 30 | } 31 | } 32 | 33 | System.out.println("---------------------------------------"); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/listener/ApplicationStartedEventListener.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.listener; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.context.event.ApplicationStartedEvent; 5 | import org.springframework.context.ApplicationListener; 6 | 7 | /** 8 | * 应用启动监听,第一个执行的监听事件 9 | * 10 | * @author lkl 11 | * @version $Id: ApplicationStartedEventListener.java, v 0.1 2015年7月27日 下午5:08:52 lkl Exp $ 12 | */ 13 | public class ApplicationStartedEventListener implements ApplicationListener { 14 | 15 | @Override 16 | public void onApplicationEvent(ApplicationStartedEvent event) { 17 | SpringApplication app = event.getSpringApplication(); 18 | app.setShowBanner(false); //启动前 设置不显示banner 19 | System.out.println(" ApplicationStartedEventListener ====>" + event.getTimestamp()); 20 | System.out.println("---------------------------------------"); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/metric/CusMetric.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.metric; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.boot.actuate.metrics.CounterService; 5 | import org.springframework.boot.actuate.metrics.GaugeService; 6 | import org.springframework.stereotype.Service; 7 | 8 | /** 9 | * 自定义计量器 10 | * CounterService 提供自增/减值 11 | * GaugeService 提供绝对值 12 | * @author lkl 13 | * @version $Id: CusMetric.java, v 0.1 2015年8月12日 下午7:52:42 lkl Exp $ 14 | */ 15 | @Service 16 | public class CusMetric { 17 | 18 | @Autowired 19 | private CounterService counterService; 20 | @Autowired 21 | private GaugeService gaugeService; 22 | 23 | public void doLogin() { 24 | this.counterService.increment("counter.login.count"); 25 | this.getAge(); 26 | } 27 | 28 | public void getAge() { 29 | this.gaugeService.submit("gauge.age", 25); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/metric/MetricsDemo.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.metric; 2 | 3 | import java.util.concurrent.TimeUnit; 4 | 5 | import com.codahale.metrics.ConsoleReporter; 6 | import com.codahale.metrics.Meter; 7 | import com.codahale.metrics.MetricRegistry; 8 | 9 | public class MetricsDemo { 10 | 11 | static final MetricRegistry metrics = new MetricRegistry(); 12 | 13 | public static void main(String args[]) throws InterruptedException { 14 | startReport(); 15 | Meter requests = metrics.meter("requests"); 16 | requests.mark(); 17 | wait5Seconds(); 18 | } 19 | 20 | static void startReport() { 21 | ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics).convertRatesTo(TimeUnit.SECONDS) 22 | .convertDurationsTo(TimeUnit.MILLISECONDS).build(); 23 | reporter.start(1, TimeUnit.SECONDS); 24 | } 25 | 26 | static void wait5Seconds() { 27 | try { 28 | Thread.sleep(5 * 1000); 29 | } catch (InterruptedException e) { 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/mongodb/PersonRepository.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.mongodb; 2 | 3 | import org.springframework.data.mongodb.repository.MongoRepository; 4 | 5 | import com.lkl.springboot.domain.Person; 6 | 7 | public interface PersonRepository extends MongoRepository { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/redis/RedisConfig.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.redis; 2 | 3 | import org.springframework.cache.CacheManager; 4 | import org.springframework.cache.annotation.EnableCaching; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.data.redis.cache.RedisCacheManager; 7 | import org.springframework.data.redis.core.RedisTemplate; 8 | 9 | /** 10 | * redis 配置 11 | * 12 | * {@link RedisProperties} //会自动加载配置 13 | * @author lkl 14 | * @version $Id: RedisConfig.java, v 0.1 2015年8月3日 下午1:31:09 lkl Exp $ 15 | */ 16 | //@Configuration 17 | @EnableCaching 18 | // 19 | public class RedisConfig { 20 | 21 | /** 22 | * 23 | * 利用redis实现缓存 24 | * 也可以利用SimpleCacheManager 25 | */ 26 | @Bean 27 | public CacheManager cacheManager(RedisTemplate redisTemplate) { 28 | RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate); 29 | cacheManager.setDefaultExpiration(300); 30 | return cacheManager; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/response/SpringBootResponse.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.response; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | 6 | @ApiModel("返回结果集") 7 | public class SpringBootResponse { 8 | 9 | @ApiModelProperty("结果码") 10 | private int code; 11 | @ApiModelProperty("处理消息") 12 | private String msg; 13 | 14 | public SpringBootResponse(int code, String msg) { 15 | super(); 16 | this.code = code; 17 | this.msg = msg; 18 | } 19 | 20 | public SpringBootResponse() { 21 | } 22 | 23 | public int getCode() { 24 | return code; 25 | } 26 | 27 | public void setCode(int code) { 28 | this.code = code; 29 | } 30 | 31 | public String getMsg() { 32 | return msg; 33 | } 34 | 35 | public void setMsg(String msg) { 36 | this.msg = msg; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/retrofit/RetrofitClient.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.retrofit; 2 | 3 | import retrofit.RestAdapter; 4 | 5 | import com.lkl.springboot.domain.Person; 6 | 7 | /** 8 | * 官方api : http://square.github.io/retrofit/ 9 | * 10 | * @author lkl 11 | * @version $Id: RetrofitClient.java, v 0.1 2015年8月4日 下午7:12:25 lkl Exp $ 12 | */ 13 | public class RetrofitClient { 14 | public static void main(String[] args) { 15 | 16 | RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint("http://localhost:8080").build(); 17 | RetrofitService retrofitService = restAdapter.create(RetrofitService.class); 18 | Person p = retrofitService.getPersonInfo("liaokailin"); 19 | System.out.println(p); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/retrofit/RetrofitService.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.retrofit; 2 | 3 | import retrofit.http.GET; 4 | import retrofit.http.Path; 5 | 6 | import com.lkl.springboot.domain.Person; 7 | import com.lkl.springboot.swagger.SwaggerConfig; 8 | 9 | /** 10 | * 通过retrofit 调用rest接口 11 | * 12 | * @author lkl 13 | * @version $Id: RetrofitService.java, v 0.1 2015年8月4日 下午7:09:56 lkl Exp $ 14 | */ 15 | interface RetrofitService { 16 | 17 | public static final String PROJECT_NAME = "springboot"; 18 | public static final String PROJECT_VERSION = "v1"; 19 | public static final String BASE_URL = "/" + SwaggerConfig.PROJECT_NAME + "/api/" 20 | + SwaggerConfig.PROJECT_VERSION; 21 | 22 | /** 23 | * 获取人员信息 24 | * 25 | * @param name 26 | * @return 27 | */ 28 | @GET(BASE_URL + "/person/{name}") 29 | Person getPersonInfo(@Path("name") String name); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/ribbon/SampleApp.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.ribbon; 2 | 3 | import java.net.URI; 4 | 5 | import com.netflix.client.ClientFactory; 6 | import com.netflix.client.http.HttpRequest; 7 | import com.netflix.client.http.HttpResponse; 8 | import com.netflix.config.ConfigurationManager; 9 | import com.netflix.loadbalancer.ZoneAwareLoadBalancer; 10 | import com.netflix.niws.client.http.RestClient; 11 | 12 | public class SampleApp { 13 | 14 | public static void main(String[] args) throws Exception { 15 | ConfigurationManager.loadPropertiesFromResources("sample-client.properties"); // 1 16 | System.out.println(ConfigurationManager.getConfigInstance().getProperty("sample-client.ribbon.listOfServers")); 17 | RestClient client = (RestClient) ClientFactory.getNamedClient("sample-client"); // 2 18 | HttpRequest request = HttpRequest.newBuilder().uri(new URI("/")).build(); // 3 19 | for (int i = 0; i < 20; i++) { 20 | HttpResponse response = client.executeWithLoadBalancer(request); // 4 21 | System.out.println("Status code for " + response.getRequestedURI() + " :" + response.getStatus()); 22 | } 23 | ZoneAwareLoadBalancer lb = (ZoneAwareLoadBalancer) client.getLoadBalancer(); 24 | System.out.println(lb.getLoadBalancerStats()); 25 | ConfigurationManager.getConfigInstance().setProperty("sample-client.ribbon.listOfServers", 26 | "www.linkedin.com:80,www.google.com:80"); // 5 27 | System.out.println("changing servers ..."); 28 | Thread.sleep(3000); // 6 29 | for (int i = 0; i < 20; i++) { 30 | HttpResponse response = client.executeWithLoadBalancer(request); 31 | System.out.println("Status code for " + response.getRequestedURI() + " : " + response.getStatus()); 32 | } 33 | System.out.println(lb.getLoadBalancerStats()); // 7 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/servlet/HelloWorldServlet.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.servlet; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.Servlet; 6 | import javax.servlet.ServletConfig; 7 | import javax.servlet.ServletException; 8 | import javax.servlet.ServletRequest; 9 | import javax.servlet.ServletResponse; 10 | 11 | public class HelloWorldServlet implements Servlet { 12 | 13 | @Override 14 | public void init(ServletConfig config) throws ServletException { 15 | // TODO Auto-generated method stub 16 | 17 | } 18 | 19 | @Override 20 | public ServletConfig getServletConfig() { 21 | // TODO Auto-generated method stub 22 | return null; 23 | } 24 | 25 | @Override 26 | public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { 27 | // TODO Auto-generated method stub 28 | 29 | } 30 | 31 | @Override 32 | public String getServletInfo() { 33 | // TODO Auto-generated method stub 34 | return null; 35 | } 36 | 37 | @Override 38 | public void destroy() { 39 | // TODO Auto-generated method stub 40 | 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/sort/MyTestSort.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.sort; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collections; 5 | import java.util.Comparator; 6 | import java.util.List; 7 | 8 | import org.springframework.core.annotation.AnnotationAwareOrderComparator; 9 | 10 | import com.google.common.collect.Lists; 11 | import com.lkl.springboot.domain.Person; 12 | 13 | /** 14 | * 排序测试 15 | * {@link Comparable} 实现去比较 16 | * {@link Comparator} 17 | * @author lkl 18 | * @version $Id: MyTestSort.java, v 0.1 2015年8月7日 下午5:04:16 lkl Exp $ 19 | */ 20 | public class MyTestSort { 21 | 22 | public static void main(String[] args) { 23 | List instances = new ArrayList(); 24 | AnnotationAwareOrderComparator.sort(instances); //观察源码 25 | } 26 | 27 | public static void testMethod() { 28 | 29 | List list = Lists.newArrayList(); 30 | for (int i = 0; i < 10; i++) { 31 | Person p = new Person(); 32 | p.setAge(i + 1); 33 | p.setName("liaokailin" + i); 34 | list.add(p); 35 | } 36 | Collections.sort(list, new Comparator() { 37 | 38 | @Override 39 | public int compare(Person o1, Person o2) { 40 | if (o1.getAge() > o2.getAge()) { 41 | return -1; 42 | } else if (o1.getAge() < o2.getAge()) { 43 | return 1; 44 | } 45 | return 0; 46 | } 47 | 48 | }); 49 | for (Person p : list) { 50 | System.out.println(p); 51 | } 52 | 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/swagger/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.swagger; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | import springfox.documentation.builders.PathSelectors; 7 | import springfox.documentation.builders.RequestHandlerSelectors; 8 | import springfox.documentation.service.ApiInfo; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /** 14 | * swagger ui 配置 15 | * visit api docs : http://localhost:8080/swagger-ui.html 16 | * doc: http://springfox.github.io/springfox/docs/current/ 17 | * @author lkl 18 | * @version $Id: SwaggerConfig.java, v 0.1 2015年8月4日 下午2:54:21 lkl Exp $ 19 | */ 20 | @EnableSwagger2 21 | @Configuration 22 | public class SwaggerConfig { 23 | public static final String PROJECT_NAME = "springboot"; 24 | public static final String PROJECT_VERSION = "v1"; 25 | 26 | /** 27 | * 28 | * Docket : 提供swagger与springmvc整合的构建器 29 | * @return 30 | */ 31 | @Bean 32 | public Docket swaggerSpringMvcPlugin() { 33 | ApiInfo apiInfo = new ApiInfo("springboot-api", "spring boot by liaokailin.", PROJECT_VERSION, "u51", 34 | "test@163.com", "lkl auth", "http://www.baidu.com"); 35 | Docket docket = new Docket(DocumentationType.SWAGGER_2); //指定使用的swagger 版本 36 | docket.groupName(PROJECT_NAME) //组名 37 | .select() //构建选择器 38 | .apis(RequestHandlerSelectors.any()).paths(PathSelectors.regex("/(" + PROJECT_NAME + "/).*")) //指定匹配路径 39 | .build().apiInfo(apiInfo) //指定api信息 40 | .useDefaultResponseMessages(false); //取消默认的返回信息 41 | return docket; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/type/TypeTest.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.type; 2 | 3 | import java.lang.reflect.ParameterizedType; 4 | import java.lang.reflect.Proxy; 5 | import java.lang.reflect.Type; 6 | import java.util.HashSet; 7 | import java.util.Set; 8 | 9 | import org.junit.Test; 10 | import org.springframework.beans.BeansException; 11 | import org.springframework.context.ApplicationContext; 12 | import org.springframework.context.ApplicationContextAware; 13 | import org.springframework.core.ResolvableType; 14 | 15 | public class TypeTest implements ApplicationContextAware { 16 | 17 | @Test 18 | public void testParameterizedType() { 19 | Set s = new HashSet(); 20 | //s.getClass().getGenericSuperclass().getClass().getName() : ParameterizedType 21 | System.out.println(s.getClass().getGenericSuperclass().getClass().getName()); 22 | System.out.println(ParameterizedType.class.isAssignableFrom(s.getClass().getGenericSuperclass().getClass())); 23 | Type[] ts = s.getClass().getGenericInterfaces(); 24 | for (Type t : ts) { 25 | System.out.println(t.getClass().getName()); 26 | } 27 | } 28 | 29 | /** 30 | * ResolvableType#hasGenerics() 判断是否存在泛型化参数 31 | */ 32 | @Test 33 | public void testResolvableType() { 34 | Set s = new HashSet(); 35 | ResolvableType c = ResolvableType.forClass(s.getClass()); 36 | System.out.println(c.hasGenerics()); // true 37 | ResolvableType rt = c.getGeneric(0);//获取泛型,由jdk的动态代理生成 38 | c = ResolvableType.forClass(TypeTest.class); 39 | System.out.println(c.hasGenerics()); //false 40 | } 41 | 42 | @Test 43 | public void testResolvableType2() { 44 | ResolvableType c = ResolvableType.forClass(Set.class); 45 | System.out.println(c.getGeneric().resolve()); 46 | } 47 | 48 | public void genericArrayTypeMethod(String[] ss) { 49 | } 50 | 51 | @Test 52 | public void test() { 53 | System.out.println(TypeTest.class.isInterface()); 54 | System.out.println(Proxy.isProxyClass(TypeTest.class)); 55 | } 56 | 57 | @Override 58 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 59 | // TODO Auto-generated method stub 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/utils/AuthTokenUtils.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.utils; 2 | 3 | import java.util.Arrays; 4 | import java.util.Map; 5 | import java.util.Set; 6 | 7 | import org.apache.commons.codec.binary.Base64; 8 | import org.apache.commons.codec.digest.DigestUtils; 9 | import org.apache.commons.lang.StringUtils; 10 | 11 | /** 12 | * 授权token生成 13 | * 14 | * @author lkl 15 | * @version $Id: AuthTokenUtils.java, v 0.1 2015年7月29日 下午11:57:46 lkl Exp $ 16 | */ 17 | public class AuthTokenUtils { 18 | 19 | public static final String SECURE_CODE = "6bda3fb5bc552d5694c9ab96c22d3734"; 20 | 21 | public static String geneToken(String key) { 22 | return Base64.encodeBase64String(DigestUtils.sha1(key + SECURE_CODE)); 23 | } 24 | 25 | public static String obatinParamsKey(Set elements, Map map) { 26 | 27 | String[] keys = elements.toArray(new String[elements.size()]); 28 | Arrays.sort(keys); 29 | StringBuffer buf = new StringBuffer(StringUtils.EMPTY); 30 | for (int i = 0, length = keys.length; i < length; i++) { 31 | buf.append(keys[i]); 32 | String[] array = map.get(keys[i]); 33 | if (array != null && array.length > 0) { 34 | for (int j = 0; j < array.length; j++) { 35 | buf.append(array[j]); 36 | } 37 | } 38 | } 39 | return DigestUtils.md5Hex(buf.toString().getBytes()); //md5 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/utils/ParamParseUtil.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.utils; 2 | 3 | import java.util.Enumeration; 4 | 5 | /** 6 | * 参数解析 7 | * 8 | * @author lkl 9 | * @version $Id: ParamParseUtil.java, v 0.1 2015年7月30日 上午12:04:22 lkl Exp $ 10 | */ 11 | public class ParamParseUtil { 12 | 13 | public static String enumeration2Array(Enumeration enumration) { 14 | if (enumration != null) { 15 | while (enumration.hasMoreElements()) { 16 | 17 | } 18 | } 19 | return null; 20 | 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/lkl/springboot/zipkin/BraveConfig.java: -------------------------------------------------------------------------------- 1 | package com.lkl.springboot.zipkin; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | import com.github.kristofa.brave.Brave; 7 | import com.github.kristofa.brave.EmptySpanCollectorMetricsHandler; 8 | import com.github.kristofa.brave.http.DefaultSpanNameProvider; 9 | import com.github.kristofa.brave.http.HttpSpanCollector; 10 | import com.github.kristofa.brave.servlet.BraveServletFilter; 11 | 12 | /** 13 | * Created by liaokailin on 16/7/27. 14 | */ 15 | @Configuration 16 | public class BraveConfig { 17 | 18 | @Bean 19 | public BraveServletFilter braveServletFilter() { 20 | Brave.Builder builder = new Brave.Builder("spring-boot-demo"); 21 | builder.spanCollector(HttpSpanCollector.create("http://110.173.14.57:9411/", 22 | new EmptySpanCollectorMetricsHandler())); 23 | Brave brave = builder.build(); 24 | BraveServletFilter filter = new BraveServletFilter(brave.serverRequestInterceptor(), 25 | brave.serverResponseInterceptor(), new DefaultSpanNameProvider()); 26 | return filter; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | hit=springboot 2 | #random num 3 | my.number=${random.int(25)} 4 | 5 | 6 | ##############################################actuator########################################################### 7 | # logging.file: /tmp/logs/app.log 8 | # logging.level.org.springframework.security: DEBUG 9 | 10 | endpoints.shutdown.enabled: true 11 | #server.tomcat.basedir: target/tomcat 12 | #server.tomcat.access_log_enabled: true 13 | #server.tomcat.access_log_pattern: %h %t "%r" %s %b 14 | security.require_ssl: false 15 | service.name: Phil 16 | #spring.jackson.serialization.INDENT_OUTPUT: true 17 | #shell.ssh.enabled: true 18 | #shell.ssh.port: 2222 19 | #shell.telnet.enabled: false 20 | #shell.telnet.port: 1111 21 | #shell.auth: spring 22 | #shell.auth: key 23 | #shell.auth.key.path: ${user.home}/test/id_rsa.pub.pem 24 | #shell.auth: simple 25 | #spring.jmx.enabled: true 26 | 27 | 28 | #endpoints.enabled=false 29 | #endpoints.info.enabled=true 30 | 31 | # set manager info 32 | # visit : localhost:8181/admin/info health... 33 | #management.context-path:/admin 34 | #management.contextPath:/admin 35 | #management.address: 127.0.0.1 36 | #management.port: 8181 37 | #management.health.status.order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP 38 | 39 | # set project info 40 | info.group: @project.groupId@ 41 | info.artifact: @project.artifactId@ 42 | info.name: @project.name@ 43 | info.version: @project.version@ 44 | info.author:liaokailin 45 | 46 | # ##set unauth can obatin detail health info ,otherwise show up or down for anonimity 47 | endpoints.health.sensitive = false 48 | 49 | 50 | # HealthIndicatorAutoConfiguration 51 | management.health.db.enabled=false 52 | management.health.rabbit.enabled=false 53 | management.health.mongo.enabled=false 54 | management.health.redis.enabled=false 55 | #management.health.solr.enabled=false 56 | 57 | #management.health.diskspace.enabled=true 58 | #management.health.diskspace.path=/ 59 | #management.health.diskspace.threshold=10485760 60 | 61 | #management.security.enabled=false 62 | 63 | #endpoints.enabled=false 64 | #endpoints.autoconfig.enabled=false 65 | #endpoints.beans.enabled=false 66 | #endpoints.configprops.enabled=false 67 | #endpoints.dump.enabled=false 68 | #endpoints.env.enabled=false 69 | #endpoints.health.enabled=true 70 | #endpoints.info.enabled=true 71 | #endpoints.metrics.enabled=false 72 | #endpoints.mappings.enabled=false 73 | #endpoints.shutdown.enabled=false 74 | #endpoints.trace.enabled=false 75 | 76 | 77 | 78 | #endpoints.beans.id=springbeans 79 | #endpoints.beans.sensitive=false 80 | #endpoints.beans.enabled=true 81 | 82 | #deny all 83 | #management.port=-1 84 | server.port=9090 85 | #https://localhost:8443/api/home 86 | #server.port=80 87 | #management.port=8888 88 | #server.ssl.enabled=true 89 | #server.ssl.keyAlias=springboot 90 | #server.ssl.keyPassword=123456 91 | #server.ssl.keyStore=/Users/liaokailin/software/ca/tomcat/.keystore 92 | 93 | 94 | 95 | 96 | 97 | 98 | ######################################################################################################### -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | application: 2 | name: liaokailin 3 | version: 0.0.1v 4 | 5 | environments: 6 | url: www.u51.com 7 | name: enniu 8 | innerClass: 9 | className: org.u51.lkl.springboot 10 | 11 | my: 12 | servers: 13 | - dev.bar.com 14 | - foo.bar.com 15 | 16 | # Server settings (ServerProperties) tomcat 配置 17 | server: 18 | port: 8080 19 | address: 127.0.0.1 20 | sessionTimeout: 30 21 | contextPath: "" 22 | 23 | -------------------------------------------------------------------------------- /src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ================================================== 2 | | | 3 | | SPRING BOOT ${spring-boot.version} | 4 | | LIAOKAILIN | 5 | | | 6 | ================================================== -------------------------------------------------------------------------------- /src/main/resources/config.properties: -------------------------------------------------------------------------------- 1 | #for archaius 2 | 3 | lock.waitTime = 100 4 | -------------------------------------------------------------------------------- /src/main/resources/logback.xml.bak: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | %d{HH:mm:ss.SSS} [%t] %X{tid} %-5level %logger{36}:%msg%n 8 | 9 | 10 | 11 | ${LOG_HOME}/springboot.log 12 | 13 | 14 | ${LOG_HOME}/springboot-%d{yyyy-MM-dd}-%i.log 15 | 17 | 10MB 18 | 19 | 10 20 | 21 | 22 | %d{HH:mm:ss.SSS} [%t] [%X{tid}--{userId}] %-5level %logger{36}:%msg%n 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/resources/sample-client.properties: -------------------------------------------------------------------------------- 1 | # Max number of retries on the same server (excluding the first try) 2 | sample-client.ribbon.MaxAutoRetries=1 3 | 4 | # Max number of next servers to retry (excluding the first server) 5 | sample-client.ribbon.MaxAutoRetriesNextServer=1 6 | 7 | # Whether all operations can be retried for this client 8 | sample-client.ribbon.OkToRetryOnAllOperations=true 9 | 10 | # Interval to refresh the server list from the source 11 | sample-client.ribbon.ServerListRefreshInterval=2000 12 | 13 | # Connect timeout used by Apache HttpClient 14 | sample-client.ribbon.ConnectTimeout=3000 15 | 16 | # Read timeout used by Apache HttpClient 17 | sample-client.ribbon.ReadTimeout=3000 18 | 19 | # Initial list of servers, can be changed via Archaius dynamic property at runtime 20 | sample-client.ribbon.listOfServers=www.baidu.com:80,www.163.com:80,www.csdn.net:80 -------------------------------------------------------------------------------- /src/main/resources/validator.properties: -------------------------------------------------------------------------------- 1 | javax.validation.constraints.AssertFalse.message = \u53EA\u80FD\u4E3Afalse 2 | javax.validation.constraints.AssertTrue.message = \u53EA\u80FD\u4E3Atrue 3 | javax.validation.constraints.DecimalMax.message = \u5FC5\u987B\u5C0F\u4E8E\u6216\u7B49\u4E8E{value} 4 | javax.validation.constraints.DecimalMin.message = \u5FC5\u987B\u5927\u4E8E\u6216\u7B49\u4E8E{value} 5 | javax.validation.constraints.Digits.message = \u6570\u5B57\u7684\u503C\u8D85\u51FA\u4E86\u5141\u8BB8\u8303\u56F4(\u53EA\u5141\u8BB8\u5728{integer}\u4F4D\u6574\u6570\u548C{fraction}\u4F4D\u5C0F\u6570\u8303\u56F4\u5185) 6 | javax.validation.constraints.Future.message = \u9700\u8981\u662F\u4E00\u4E2A\u5C06\u6765\u7684\u65F6\u95F4 7 | javax.validation.constraints.Max.message = \u6700\u5927\u4E0D\u80FD\u8D85\u8FC7{value} 8 | javax.validation.constraints.Min.message = \u6700\u5C0F\u4E0D\u80FD\u5C0F\u4E8E{value} 9 | javax.validation.constraints.NotNull.message = 为空了啊 哈哈哈!! 10 | javax.validation.constraints.Null.message = \u5FC5\u987B\u4E3Anull 11 | javax.validation.constraints.Past.message = \u9700\u8981\u662f\u4e00\u4e2a\u8fc7\u53bb\u7684\u65F6\u95F4 12 | javax.validation.constraints.Pattern.message = \u9700\u8981\u5339\u914D\u6B63\u5219\u8868\u8FBE\u5F0F"{regexp}" 13 | javax.validation.constraints.Size.message = \u4E2A\u6570\u5FC5\u987B\u5728{min}\u548C{max}\u4E4B\u95F4 14 | -------------------------------------------------------------------------------- /src/main/resources/xml_config.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/test/java/com/lkl/framework/CusEvent.java: -------------------------------------------------------------------------------- 1 | package com.lkl.framework; 2 | 3 | import java.util.EventObject; 4 | 5 | /** 6 | * 自定义事件 7 | * 事件封装对应的事件源以及事件的参数 8 | * 9 | * 10 | * @author lkl 11 | * @version $Id: CusEvent.java, v 0.1 2015年7月19日 下午10:09:36 lkl Exp $ 12 | */ 13 | public class CusEvent extends EventObject { 14 | 15 | public CusEvent(Object source) { //在父类中定义了source 保存事件源 16 | super(source); 17 | } 18 | 19 | private static final long serialVersionUID = -4252348226547895702L; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/test/java/com/lkl/framework/CusEventListener.java: -------------------------------------------------------------------------------- 1 | package com.lkl.framework; 2 | 3 | import java.util.EventListener; 4 | 5 | /** 6 | * 事件监听器 7 | * 8 | * @author lkl 9 | * @version $Id: CusEventListener.java, v 0.1 2015年7月19日 下午10:14:01 lkl Exp $ 10 | */ 11 | public class CusEventListener implements EventListener { 12 | 13 | public void fireCusEvent(CusEvent event) { 14 | EventSourceObject eventSource = (EventSourceObject) event.getSource();//获取事件源 15 | System.out.println("监听内容:" + eventSource.getClickContent()); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/test/java/com/lkl/framework/EventSourceObject.java: -------------------------------------------------------------------------------- 1 | package com.lkl.framework; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | /** 7 | * 事件源 事件发生的地方 8 | * 由于事件源的某项属性或状态发生了改变(比如BUTTON被单击、TEXTBOX的值发生改变等等)导致某项事件发生。 9 | * 换句话说就是生成了相应的事件对象。 10 | * 因为事件监听器要注册在事件源上,所以事件源类中应该要有盛装监听器的容器(List,Set等等) 11 | * 12 | * @author lkl 13 | * @version $Id: EventSourceObject.java, v 0.1 2015年7月19日 下午10:16:48 lkl Exp $ 14 | */ 15 | public class EventSourceObject { 16 | 17 | private String clickContent; 18 | private Set listenerContainer = new HashSet(); 19 | 20 | public void addListener(CusEventListener listener) { 21 | listenerContainer.add(listener); 22 | } 23 | 24 | public void notifies(CusEvent event) { //通知监听器 这是观察者设计模式 25 | for (CusEventListener listener : listenerContainer) { 26 | listener.fireCusEvent(event); 27 | } 28 | } 29 | 30 | /** 31 | * 创建时间的方法,最后是放到子类去继承实现,在增加新的事件的时候,就不会出现问题 32 | */ 33 | public void clickButton() { //按钮点击,点击后,触发点击事件(extend CusEvent) 然后通知listener 34 | System.out.println("在事件源中发生点击事件"); 35 | CusEvent event = new CusEvent(this); 36 | clickContent = "按钮被点击"; 37 | this.notifies(event); 38 | } 39 | 40 | public String getClickContent() { 41 | return clickContent; 42 | } 43 | 44 | public void setClickContent(String clickContent) { 45 | this.clickContent = clickContent; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/test/java/com/lkl/framework/GenericTypeResolverTest.java: -------------------------------------------------------------------------------- 1 | package com.lkl.framework; 2 | 3 | import org.springframework.context.ApplicationListener; 4 | import org.springframework.core.GenericTypeResolver; 5 | 6 | import com.lkl.springboot.listener.ApplicationStartedEventListener; 7 | 8 | public class GenericTypeResolverTest { 9 | 10 | public static void main(String[] args) { 11 | 12 | /** 13 | * GenericTypeResolver: 泛型解析器 14 | * GenericTypeResolver.resolveTypeArgument 15 | * 获取实现的接口,或者父类中的泛型类型 16 | */ 17 | Class clazz = GenericTypeResolver.resolveTypeArgument(ApplicationStartedEventListener.class, 18 | ApplicationListener.class); 19 | System.out.println(clazz); //class org.springframework.boot.context.event.ApplicationStartedEvent 20 | 21 | System.out.println(ApplicationListener.class.isAssignableFrom(ApplicationStartedEventListener.class)); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/com/lkl/framework/ParseAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.lkl.framework; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.core.annotation.AnnotationAttributes; 5 | import org.springframework.core.type.StandardAnnotationMetadata; 6 | 7 | import com.lkl.springboot.Application; 8 | 9 | public class ParseAnnotation { 10 | public static void main(String[] args) { 11 | StandardAnnotationMetadata meta = new StandardAnnotationMetadata(Application.class, true); 12 | // AnnotationAttributes componentScan = AnnotationConfigUtils.attributesFor(meta, ComponentScan.class); 13 | AnnotationAttributes s = AnnotationAttributes.fromMap(meta.getAnnotationAttributes( 14 | ComponentScan.class.getName(), false)); 15 | meta.getMetaAnnotationTypes("xxx");//获取执行注解的方法 16 | System.out.println(s); 17 | System.out.println(meta.getAnnotationTypes()); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/com/lkl/framework/Singleton.java: -------------------------------------------------------------------------------- 1 | package com.lkl.framework; 2 | 3 | /** 4 | * 单例,考虑多线程 5 | * @author lkl 6 | * 7 | */ 8 | public class Singleton { 9 | 10 | private Singleton() { 11 | System.out.println("---construct----"); 12 | } 13 | 14 | /** 15 | * 类级内部类相当于其外部类的成员,只有在第一次被使用的时候才被会装载 16 | */ 17 | static class SingletonHolder { 18 | private static Singleton instance = new Singleton(); 19 | } 20 | 21 | public static Singleton getInstance() { 22 | return SingletonHolder.instance; 23 | } 24 | 25 | public static String getInstance1() { 26 | return "123"; 27 | } 28 | 29 | public static void main(String[] args) { 30 | System.out.println(getInstance1()); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/com/lkl/framework/StrSubstitutorTest.java: -------------------------------------------------------------------------------- 1 | package com.lkl.framework; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import org.apache.commons.lang.text.StrLookup; 7 | import org.apache.commons.lang.text.StrSubstitutor; 8 | 9 | 10 | public class StrSubstitutorTest { 11 | private static Map map = new HashMap(); 12 | static { 13 | for (int i = 0; i < 10; i++) { 14 | map.put(i + "", "test-" + i); 15 | } 16 | } 17 | 18 | public static void main(String[] args) { 19 | 20 | String test = "The ${1} jumped over the ${2}"; 21 | StrSubstitutor str = new StrSubstitutor(new StrLookup() { 22 | 23 | @Override 24 | public String lookup(String key) { 25 | String prop = getProperty(key); 26 | return (prop != null) ? prop : null; 27 | } 28 | 29 | private String getProperty(String key) { 30 | return map.get(key).toString(); 31 | } 32 | 33 | }); 34 | System.out.println(str.replace(test)); // 结果: The test-1 jumped over the test-2 35 | ; 36 | 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/test/java/com/lkl/framework/TestEvent.java: -------------------------------------------------------------------------------- 1 | package com.lkl.framework; 2 | 3 | 4 | public class TestEvent { 5 | 6 | public static void main(String[] args) { 7 | EventSourceObject eventSource = new EventSourceObject(); 8 | eventSource.addListener(new CusEventListener()); 9 | eventSource.addListener(new CusEventListener()); 10 | eventSource.addListener(new CusEventListener()); 11 | eventSource.clickButton(); 12 | 13 | } 14 | } 15 | --------------------------------------------------------------------------------