<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    java學(xué)習(xí)

    java學(xué)習(xí)

     

    linux mysql 安裝步驟

    1、安裝cmake    (可能需要安裝  yum install gcc-c++)
    2、安裝yum install ncurses-devel -y
    3.創(chuàng)建用戶和組 groupadd mysql
    useradd mysql -s /sbin/nologin -M -g mysql
    4、tar xf mysql-5.5.32.tar.gz
    5、進(jìn)入MySQL目錄,(可能需要 yum install bison)執(zhí)行
    cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=ON -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 -DWITHOUT_PARTITION_STORAGE_ENGINE=1 -DWITH_FAST_MUTEXES=1 -DWITH_ZLIB=bundled -DENABLED_LOCAL_INFILE=1 -DWITH_READLINE=1 -DWITH_EMBEDDED_SERVER=1 -DWITH_DEBUG=0 -DMYSQL_TCP_PORT=3306
    6、make && make install
    7、cp mysql-5.5.32/support-files/my-small.cnf /etc/my.cnf
    8、添加環(huán)境變量   export PATH=/usr/local/mysql/bin:$PATH
    9、授權(quán) chown -R mysql.mysql /usr/local/mysql/data/ 
    10、chmod -R 1777 /tmp/
    11、在MySQL的安裝目錄下的scripts文件夾下,執(zhí)行./mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysql
    12、負(fù)責(zé)MySQL啟動(dòng)命令   cp support-files/mysql.server /etc/init.d/mysqld
    13、授權(quán)chmod +x /etc/init.d/mysqld
    14、啟動(dòng)MySQL    /etc/init.d/mysqld start
    15、查看運(yùn)行的進(jìn)程  netstat -lntup|grep 3306
    16、刪除無用的用戶和host,select user,host from mysql.user ;
    刪除test數(shù)據(jù)庫(kù)
    17、刪除root用戶,添加別的數(shù)據(jù)庫(kù)管理員
    delete from mysql.user;
    grant all privileges on *.* to system@'localhost' identified by 'yjw' with grant option;
    /usr/local/mysql//bin/mysqladmin -u root password 'new-password'    --設(shè)置密碼
    /usr/local/mysql//bin/mysqladmin -u root -h bogon password 'root'  --修改密碼

    posted @ 2018-04-26 14:02 楊軍威 閱讀(122) | 評(píng)論 (0)編輯 收藏

    gtk安裝

    linux下GTK+的一鍵安裝和配置:(fedora16和centos下配置成功)

    必要組件:

     yum install gtk2 gtk2-devel gtk2-devel-docs

    可選組件:

     yum install gnome-devel gnome-devel-docs

    posted @ 2018-04-05 18:06 楊軍威 閱讀(158) | 評(píng)論 (0)編輯 收藏

    eclipse linux java in your current PATH

    A Java Runtime Environment (JRE) or Java Development Kit (JDK)
    must be available in order to run Eclipse. No Java virtual machine
    was found after searching the following locations:
    /home/injavawetrust/program/eclipse/jre/bin/java
    java in your current PATH

    解決辦法是在終端進(jìn)入你的eclipse目錄,然后輸入:

    mkdir jre
    cd jre
    ln -s 你的JDK目錄/bin bin

    posted @ 2018-04-05 17:24 楊軍威 閱讀(1023) | 評(píng)論 (0)編輯 收藏

    git 解決 unable to get local issuer certificate 問題

    方法一:

    如果你是用命令行提交的,可以用以下命令設(shè)置臨時(shí)環(huán)境變量GIT_SSL_NO_VERIFY。 
    Windows下:

    set GIT_SSL_NO_VERIFY=true git push
    • 1

    Linux下:

    env GIT_SSL_NO_VERIFY=true git push
    • 1

    設(shè)置好之后,然后用Git提交。 
    當(dāng)然,你也可以把GIT_SSL_NO_VERIFY設(shè)置成非臨時(shí)環(huán)境變量,這樣就不用每次提交都要執(zhí)行上面的命令了。

    方法二:

    你也可以在命令行執(zhí)行以下命令,之后再提交。

    git config --global http.sslVerify false
    以上兩個(gè)方法,親測(cè)有效,建議第二個(gè),直接去掉git的ssl驗(yàn)證

    posted @ 2018-03-26 10:22 楊軍威 閱讀(10186) | 評(píng)論 (0)編輯 收藏

    springcloud中的自定義ribbon客戶端負(fù)載均衡配置

    1、不在啟動(dòng)類同級(jí)的包目錄中新建ribbon配置類
    @Configuration
    public class TestConfiguration {
    @Autowired
    IClientConfig config;
      @Bean
      public IRule ribbonRule(IClientConfig config) {
        return new RandomRule();
      }
    }
    在啟動(dòng)類中添加注解@RibbonClient
    @SpringBootApplication
    @EnableEurekaClient //針對(duì)Eureka服務(wù)注冊(cè)使用
    //@EnableDiscoveryClient  //可以對(duì)其他服務(wù)注冊(cè)軟件使用
    @RibbonClient(name="a-microservice-provider-user",configuration=TestConfiguration.class)
    public class ConsumerMovieRibbonApplication {
    @Bean
    @LoadBalanced//客戶端負(fù)載均衡,先把服務(wù)提供這所有的節(jié)點(diǎn)讀取到ribbon注冊(cè)表中,默認(rèn)輪詢請(qǐng)求服務(wù)
    public RestTemplate getRestTemplate() {
    return new RestTemplate();
    public static void main(String[] args) {
    SpringApplication.run(ConsumerMovieRibbonApplication.class, args);
    }
    }
    3.在controller中添加方法
    @GetMapping("/movie/{userid}")
    public TUser test2(@PathVariable(name="userid") String userId) {
    //服務(wù)的自動(dòng)發(fā)現(xiàn),不用配置死的IP和端口,只有在RestTemplate添加了@LoadBalanced接口,才能使用應(yīng)用名稱訪問
    return restTemplate.getForObject("http://a-microservice-provider-user/users/"+userId, TUser.class);
    }
    4、啟動(dòng)服務(wù)發(fā)現(xiàn)服務(wù)eureka和服務(wù)提供類,調(diào)用目標(biāo)方法,可以成功 調(diào)用。

    posted @ 2018-03-21 17:50 楊軍威 閱讀(706) | 評(píng)論 (0)編輯 收藏

    springcloud微服務(wù)服務(wù)發(fā)現(xiàn)eureka服務(wù)和客戶端服務(wù)的搭建

    一、服務(wù)端的搭建
    1、在pom文件中添加eureka服務(wù)依賴
                    <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-eureka-server</artifactId>
    </dependency>
    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    2、編寫application.yml 配置
    security:
      basic:
        enabled: true
      user:
        name: user
        password: password123
    server:
      port: 8761
    eureka:
      client:
        register-with-eureka: false #只把此服務(wù)當(dāng)成eurekaservice,不要當(dāng)成client
        fetch-registry: false #只把此服務(wù)當(dāng)成eurekaservice,不要當(dāng)成client
        service-url:
          defaultZone: http://user:password123@localhost:8761/eureka
    3、在啟動(dòng)類上添加注解
    @SpringBootApplication
    @EnableEurekaServer
    就可以啟動(dòng)服務(wù)發(fā)現(xiàn)的服務(wù)端程序了。
    二、客戶端的搭建
    1、在pom文件中添加依賴
                <dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-eureka</artifactId>
    </dependency>
    2、編寫application.yml 配置
    server:  
      port: 7901  
      session-timeout: 30  
      tomcat.max-threads: 0  
      tomcat.uri-encoding: UTF-8  
      
    spring:  
      application:
        name: a-microservice-consumer-movie
    logging:
      level:
        root: INFO
        com.example.demo: debug
    eureka:
      client:
        serviceUrl:
          defaultZone: http://user:password123@localhost:8761/eureka
          instance: #eureka管理頁(yè)面客戶端服務(wù)的地址顯示實(shí)際IP
            prefer-ip-address: true   #默認(rèn)是false
    3、在啟動(dòng)類添加注解
    @SpringBootApplication
    @EnableEurekaClient //針對(duì)Eureka服務(wù)注冊(cè)使用
    //@EnableDiscoveryClient  //可以對(duì)其他服務(wù)注冊(cè)軟件使用
    這樣客戶端配置完畢,先啟動(dòng)服務(wù)端,再啟動(dòng)客戶端,服務(wù)端就可以自動(dòng)發(fā)現(xiàn)客戶端服務(wù)了。
        

    posted @ 2018-03-21 14:09 楊軍威 閱讀(703) | 評(píng)論 (0)編輯 收藏

    soringboot項(xiàng)目大war包,部署到Tomcat步驟

    springboot的應(yīng)用打包默認(rèn)是打成jar包,并且如果是web應(yīng)用的話,默認(rèn)使用內(nèi)置的tomcat充當(dāng)servlet容器,但畢竟內(nèi)置的tomcat有時(shí)候并不滿足我們的需求,如有時(shí)候我們想集群或者其他一些特性優(yōu)化配置,因此我們需要把springboot的jar應(yīng)用打包成war包,并能夠在外部tomcat中運(yùn)行。
        很多人會(huì)疑問,你直接打成war包并部署到tomcat的webapp下不就行了么?No,springboot的如果在類路徑下有tomcat相關(guān)類文件,就會(huì)以內(nèi)置tomcat啟動(dòng)的方式,經(jīng)過你把war包扔到外置的tomcat的webapp文件下啟動(dòng)springBoot應(yīng)用也無事于補(bǔ)。
        要把springboot應(yīng)用轉(zhuǎn)至外部tomcat的操作主要有以下三點(diǎn):
    1、把pom.xml文件中打包結(jié)果由jar改成war,如下:
    [html] view plain copy
    1. <modelVersion>4.0.0</modelVersion>  
    2. <groupId>spring-boot-panminlan-mybatis-test</groupId>  
    3. <artifactId>mybatis-test</artifactId>  
    4. <packaging>war</packaging>  
    5. <version>0.0.1-SNAPSHOT</version>  

    2、添加maven的war打包插件如下:并且給war包起一個(gè)名字,tomcat部署后的訪問路徑會(huì)需要,如:http:localhost:8080/myweb/****

      
    [java] view plain copy
    1. <plugin>       
    2.    <groupId>org.apache.maven.plugins</groupId>       
    3.    <artifactId>maven-war-plugin</artifactId>       
    4.    <configuration>       
    5.     <warSourceExcludes>src/main/resources/**</warSourceExcludes>  
    6.     <warName>myweb</warName>       
    7.    </configuration>       
    8.   </plugin>       

    3、排除org.springframework.boot依賴中的tomcat內(nèi)置容器,這是很重要的一步

    [java] view plain copy
    1. <dependency>  
    2.         <groupId>org.springframework.boot</groupId>  
    3.         <artifactId>spring-boot-starter-web</artifactId>  
    4.         <exclusions>  
    5.             <exclusion>  
    6.                 <groupId>org.springframework.boot</groupId>  
    7.                 <artifactId>spring-boot-starter-tomcat</artifactId>  
    8.             </exclusion>  
    9.         </exclusions>  
    10.     </dependency>  

    4、添加對(duì)servlet API的依賴
    [java] view plain copy
    1. <dependency>  
    2.             <groupId>javax.servlet</groupId>  
    3.             <artifactId>javax.servlet-api</artifactId>  
    4.         </dependency>  

    5、繼承SpringBootServletInitializer ,并覆蓋它的 configure 方法,如下圖代碼,為什么需要提供這樣一個(gè)SpringBootServletInitializer子類并覆蓋它的config方法呢,我們看下該類原代碼的注釋:
    /**Note that a WebApplicationInitializer is only needed if you are building a war file and
     * deploying it. If you prefer to run an embedded container then you won't need this at
     * all.
    如果我們構(gòu)建的是wai包并部署到外部tomcat則需要使用它,如果使用內(nèi)置servlet容器則不需要,外置tomcat環(huán)境的配置需要這個(gè)類的configure方法來指定初始化資源。
    [java] view plain co@SpringBootApplication
    //@ServletComponentScan
    public class JobManagementApplication extends SpringBootServletInitializer{

         @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
                return application.sources(JobManagementApplication.class);
            }
        public static void main(String[] args) {
            SpringApplication.run(JobManagementApplication.class, args);
        }
    }
    經(jīng)過以上配置,我們把構(gòu)建好的war包拷到tomcat的webapp下,啟動(dòng)tomcat就可以訪問啦

    posted @ 2018-03-17 18:39 楊軍威 閱讀(657) | 評(píng)論 (0)編輯 收藏

    soringboot熱部署配置

    在pom文件中加入
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
        <scope>true</scope> 
    </dependency>


     <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                </configuration>
            </plugin>



    posted @ 2018-03-15 14:40 楊軍威 閱讀(152) | 評(píng)論 (0)編輯 收藏

    在springboot中fastjson的配置

    第一種配置方法:
    在實(shí)體類中加入格式化屬性的注解
    public class User implements Serializable{
    /**
    */
    private static final long serialVersionUID = 1L;
    private Integer id;
    private String username;
    private Date birthday;
    private Integer age;
    public Integer getId() {
    return id;
    }
    public void setId(Integer id) {
    this.id = id;
    }
    @JSONField(format="yyyy-MM-dd hh:MM:ss")
    public Date getBirthday() {
    return birthday;
    }
    public void setBirthday(Date birthday) {
    this.birthday = birthday;
    }
    public String getUsername() {
    return username;
    }
    public void setUsername(String username) {
    this.username = username;
    }
    public Integer getAge() {
    return age;
    }
    public void setAge(Integer age) {
    this.age = age;
    }
    2.在啟動(dòng)類中繼承類
    @SpringBootApplication
    public class Demo1Application2 extends WebMvcConfigurerAdapter{
    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
    super.configureMessageConverters(converters);
    FastJsonHttpMessageConverter fastConverter=new  FastJsonHttpMessageConverter();
    FastJsonConfig fastJsonConfig = new FastJsonConfig();
    fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
    fastConverter.setFastJsonConfig(fastJsonConfig);
    converters.add(fastConverter);
    }
    public static void main(String[] args) {
    SpringApplication app=new SpringApplication(Demo1Application2.class);
    ConfigurableApplicationContext context = app.run( args);
    //context.close();
    }
    }
    3.訪問頁(yè)面,請(qǐng)求方法,得到結(jié)果
    { "age":11, "birthday":"2018-03-15 10:03:55", "id":1, "username":"dddd" }
    第二種配置方法:
    在啟動(dòng)類加入一個(gè)bean
    @SpringBootApplication
    public class Demo1Application3 {
    @Bean
    public HttpMessageConverters fastJsonHttpMessageConverters() {
    FastJsonHttpMessageConverter fastConverter=new  FastJsonHttpMessageConverter();
    FastJsonConfig fastJsonConfig = new FastJsonConfig();
    fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
    fastConverter.setFastJsonConfig(fastJsonConfig);
    HttpMessageConverter<?> converters=fastConverter;
    return new HttpMessageConverters(converters);
    }
    public static void main(String[] args) {
    SpringApplication app=new SpringApplication(Demo1Application3.class);
    ConfigurableApplicationContext context = app.run( args);
    //context.close();
    }
    }

    posted @ 2018-03-15 10:36 楊軍威 閱讀(1184) | 評(píng)論 (0)編輯 收藏

    利用BeanPostProcessor接口實(shí)現(xiàn)bean初始化的前后執(zhí)行方法

    1、aop的簡(jiǎn)單實(shí)現(xiàn)
    public class User implements InitializingBean,DisposableBean{
    public String toString() {
    System.out.println("userdddd");
    return "444";
    }
    @Override
    public void afterPropertiesSet() throws Exception {
    System.out.println(" user afterPropertiesSet");
    }
    @Override
    public void destroy() throws Exception {
    System.out.println("user destroy");
    }
    }
    public class LogUser extends User{
    public String toString() {
    System.out.println("log start");
    super.toString();
    System.out.println("log end");
    return "";
    }
    }
    public interface MyApplicationContextAware {
    void setApplicationContext(ApplicationContext applicationContext) throws BeansException;
    }
    @Component
    public class Dog4 implements MyApplicationContextAware{
    ApplicationContext applicationContext;
    public ApplicationContext getApplicationContext() {
    return applicationContext;
    }
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
    this.applicationContext=applicationContext;
    }
    }
    @Component
    public class MyBeanPostProcessor implements BeanPostProcessor{
    @Autowired
    ApplicationContext applicationContext;
    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
    System.out.println("postProcessAfterInitialization=="+beanName);
    return BeanPostProcessor.super.postProcessAfterInitialization(bean, beanName);
    }
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
    System.out.println("postProcessBeforeInitialization=="+beanName);
    if(bean instanceof User) {
    return new LogUser();
    }
    if(bean instanceof MyApplicationContextAware) {
    MyApplicationContextAware my=(MyApplicationContextAware) bean;
    my.setApplicationContext(applicationContext);
    }
    return BeanPostProcessor.super.postProcessBeforeInitialization(bean, beanName);
    }
    }
    public class App {
    public static void main(String[] args) {
    AnnotationConfigApplicationContext aa=new AnnotationConfigApplicationContext("com.yjw");
    Dog4 dog = aa.getBean(Dog4.class);
    System.out.println(dog.getApplicationContext());
    User user = aa.getBean(User.class);
    System.out.println(user.toString());
    aa.close();
    }
    }

    posted @ 2018-03-06 15:34 楊軍威 閱讀(469) | 評(píng)論 (0)編輯 收藏

    僅列出標(biāo)題
    共43頁(yè): 上一頁(yè) 1 2 3 4 5 6 7 8 9 下一頁(yè) Last 

    導(dǎo)航

    統(tǒng)計(jì)

    常用鏈接

    留言簿

    隨筆檔案

    搜索

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 午夜性色一区二区三区免费不卡视频| 在线电影你懂的亚洲| 青青草免费在线视频| 免费国产叼嘿视频大全网站| 免费看美女午夜大片| 亚洲熟妇av午夜无码不卡| 亚洲网址在线观看| 亚洲AV综合色区无码一区爱AV | 亚洲区小说区图片区| 午夜神器成在线人成在线人免费| a级毛片高清免费视频就| 春意影院午夜爽爽爽免费| 精品韩国亚洲av无码不卡区| 亚洲综合无码一区二区痴汉 | 7m凹凸精品分类大全免费| a级毛片在线免费| 毛片基地看看成人免费| 免费无码国产在线观国内自拍中文字幕 | 亚洲AV成人片色在线观看| 亚洲一区日韩高清中文字幕亚洲 | 亚洲精品无码av中文字幕| 亚洲一区二区三区久久| 亚洲成年人免费网站| 亚洲熟妇av一区二区三区下载| 亚洲自偷自拍另类12p| 亚洲成色在线影院| 亚洲Av熟妇高潮30p| 久久丫精品国产亚洲av不卡| 亚洲电影免费在线观看| 亚洲人成网站影音先锋播放| 亚洲AV无码乱码在线观看富二代 | 日韩免费视频一区二区| 暖暖日本免费中文字幕| 四虎影视成人永久免费观看视频 | 亚洲色图在线播放| 亚洲人成依人成综合网| 亚洲乱码在线播放| 亚洲午夜理论片在线观看| 亚洲精品av无码喷奶水糖心| 亚洲av永久中文无码精品综合| 国产精品亚洲一区二区三区久久 |