Spring Boot Setting & Memorandum Clause Pom Setting Export Setting plagin
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 <plugins > <plugin > <groupId > org.springframework.boot</groupId > <artifactId > spring-boot-maven-plugin</artifactId > <configuration > <includeSystemScope > true</includeSystemScope > </configuration > </plugin > <plugin > <groupId > org.apache.maven.plugins</groupId > <artifactId > maven-war-plugin</artifactId > <configuration > <webResources > <resource > <directory > src/main/resources/lib</directory > <targetPath > WEB-INF/lib/</targetPath > <includes > <include > **/*.jar</include > </includes > </resource > </webResources > </configuration > </plugin > </plugins >
dependency
1 2 3 4 5 6 7 <dependency > <groupId > com.rxtxcomm</groupId > //suit yourself <artifactId > sdk</artifactId > //suit yourseld <scope > system</scope > //suit your self <version > 3.0.0.0</version > //suit your self <systemPath > ${pom.basedir}/src/main/resources/lib/RXTXcomm.jar</systemPath > //path </dependency >
Annotation
Configuration
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.web.cors.CorsConfiguration;import org.springframework.web.cors.UrlBasedCorsConfigurationSource;import org.springframework.web.filter.CorsFilter;@Configuration public class GlobalCorsConfig { @Bean public CorsFilter corsFilter () { CorsConfiguration config = new CorsConfiguration(); config.addAllowedOrigin("*" ); config.setAllowCredentials(true ); config.addAllowedMethod("*" ); config.addAllowedHeader("*" ); UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource(); configSource.registerCorsConfiguration("/**" , config); return new CorsFilter(configSource); } }
If you like this blog or find it useful for you, you are welcome to comment on it. You are also welcome to share this blog, so that more people can participate in it. If the images used in the blog infringe your copyright, please contact the author to delete them. Thank you !