spring boot
springboot之使用tomcat部署脚本及环境设置
星期三, 一月 8th, 2020 | JAVA-and-J2EE, linux | 没有评论
1.部署脚本deploy.sh
cp /ia/apps/java/pomelolee-1.0.0-GA.war /usr/local/webserver/apache-tomcat-9/webapps/ROOT.war |
2.启动脚本start.sh
/usr/local/webserver/apache-tomcat-9/bin/startup.sh |
3.关闭脚本shut.sh
/usr/local/webserver/apache-tomcat-9/bin/shutdown.sh |
4.配置指定tomcat容器加载springboot的启动配置文件
在/usr/local/webserver/apache-tomcat-9/bin 文件夹下设置setenv.sh文件指定文件加载配置,toncat启动时 会自动加载此配置
其他jvm的调优配置也都直接配置到此处,方便复用;启用配置中心的部分可以参考激活设置,此处不用做说明.
CATALINA_OPTS="$CATALINA_OPTS -Dspring.config.location=/ia/config/pomelolee/application.properties" |
Spring Boot 的核心注解SpringBootApplication引起的探究
星期二, 十二月 3rd, 2019 | JAVA-and-J2EE, spring-boot | 没有评论
Spring Boot 的核心注解SpringBootApplication引起的探究
1.Spring Boot 的核心注解是哪个?
先上一个工程的启动配置项看下:
项目比较老混杂了spring boot,dubbo,jersey注册等
package com.pomelolee.cms; import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig; import com.pomelolee.boot.dubbo.annotation.EnableDubboProvider; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.servlet.ServletProperties; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.netflix.feign.EnableFeignClients; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; import org.springframework.context.annotation.ImportResource; import org.springframework.util.ClassUtils; import java.util.HashSet; import java.util.Set; @EnableFeignClients @SpringBootApplication @EnableApolloConfig @EnableDiscoveryClient @EnableDubboProvider @ImportResource("classpath*:/META-INF/spring/spring-job.xml") public class Application extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } @Bean public ResourceConfig resourceConfig() { ResourceConfig resourceConfig = new ResourceConfig(); ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(true); Set<beandefinition> beanDefinitionSet = scanner.findCandidateComponents("com.pomelolee.cms.service"); beanDefinitionSet.addAll(scanner.findCandidateComponents("com.pomelolee.cms.facade")); beanDefinitionSet.addAll(scanner.findCandidateComponents("com.pomelolee.cms.config")); Set<Class<?>> clazzSet = new HashSet<Class<?>>(); for (BeanDefinition beanDefinition : beanDefinitionSet) { clazzSet.add( ClassUtils.resolveClassName( beanDefinition.getBeanClassName(), resourceConfig.getClassLoader())); } resourceConfig.registerClasses(clazzSet); resourceConfig.property(ServletProperties.FILTER_FORWARD_ON_404, true); return resourceConfig; } } </beandefinition> |
@SpringBootApplication 注解,就是 Spring Boot 的核心注解。
Search
相关文章
热门文章
最新文章
文章分类
- ajax (10)
- algorithm-learn (3)
- Android (6)
- as (3)
- computer (85)
- Database (30)
- disucz (4)
- enterprise (1)
- erlang (2)
- flash (5)
- golang (3)
- html5 (18)
- ios (4)
- JAVA-and-J2EE (186)
- linux (143)
- mac (10)
- movie-music (11)
- pagemaker (36)
- php (50)
- spring-boot (2)
- Synology群晖 (2)
- Uncategorized (6)
- unity (1)
- webgame (15)
- wordpress (33)
- work-other (2)
- 低代码 (1)
- 体味生活 (40)
- 前端 (21)
- 大数据 (8)
- 游戏开发 (9)
- 爱上海 (19)
- 读书 (4)
- 软件 (3)