Commit 7606b694 authored by 张俊's avatar 张俊

升级tomcat版本改造

parent f6a2cb52
...@@ -12,7 +12,7 @@ import org.springframework.stereotype.Controller; ...@@ -12,7 +12,7 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@Controller() @Controller
@RequestMapping(value = "/encrypt") @RequestMapping(value = "/encrypt")
public class EncryptController { public class EncryptController {
......
...@@ -3,8 +3,6 @@ package com.changda.gjjapp.encryptor; ...@@ -3,8 +3,6 @@ package com.changda.gjjapp.encryptor;
import org.jasypt.encryption.StringEncryptor; import org.jasypt.encryption.StringEncryptor;
import org.jasypt.encryption.pbe.PooledPBEStringEncryptor; import org.jasypt.encryption.pbe.PooledPBEStringEncryptor;
import org.jasypt.encryption.pbe.StandardPBEByteEncryptor; import org.jasypt.encryption.pbe.StandardPBEByteEncryptor;
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig;
import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig; import org.jasypt.encryption.pbe.config.SimpleStringPBEConfig;
import org.jasypt.spring4.properties.EncryptablePropertyPlaceholderConfigurer; import org.jasypt.spring4.properties.EncryptablePropertyPlaceholderConfigurer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
...@@ -14,21 +12,40 @@ import org.springframework.core.io.DefaultResourceLoader; ...@@ -14,21 +12,40 @@ import org.springframework.core.io.DefaultResourceLoader;
@Configuration @Configuration
public class EncryptorConfig { public class EncryptorConfig {
/*@Bean
public StandardPBEStringEncryptor standardPBEStringEncryptor() {
EnvironmentStringPBEConfig stringPBEConfig = new EnvironmentStringPBEConfig();
stringPBEConfig.setAlgorithm("PBEWithMD5AndDES");
stringPBEConfig.setPassword("root");
StandardPBEStringEncryptor pbeStringEncryptor = new StandardPBEStringEncryptor();
pbeStringEncryptor.setConfig(stringPBEConfig);
return pbeStringEncryptor;
}*/
/**
* 必须为 static 方法,确保 BeanFactoryPostProcessor 最先被 Spring 创建,
* 且不依赖其他 Bean(如 StringEncryptor),避免循环依赖导致占位符未被解析。
* 同时加载 gjj.properties 和 gjj_bussiness.property,确保所有 ${...} 占位符都能被解析。
*/
@Bean @Bean
public EncryptablePropertyPlaceholderConfigurer propertyConfigurer(StringEncryptor pbeStringEncryptor) { public static EncryptablePropertyPlaceholderConfigurer propertyConfigurer() {
EncryptablePropertyPlaceholderConfigurer placeholderConfigurer = new EncryptablePropertyPlaceholderConfigurer(pbeStringEncryptor); PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor();
SimpleStringPBEConfig config = new SimpleStringPBEConfig();
// 加密盐值
config.setPassword("gjjcdgs856177110");
// 加密算法
config.setAlgorithm(StandardPBEByteEncryptor.DEFAULT_ALGORITHM);
// key迭代次数
config.setKeyObtentionIterations("1000");
// 池大小
config.setPoolSize("1");
config.setProviderName("SunJCE");
// 随机盐生成器
config.setSaltGeneratorClassName("org.jasypt.salt.RandomSaltGenerator");
config.setIvGeneratorClassName("org.jasypt.iv.RandomIvGenerator");
// 加密后输出字符串编码方式
config.setStringOutputType("base64");
encryptor.setConfig(config);
EncryptablePropertyPlaceholderConfigurer placeholderConfigurer = new EncryptablePropertyPlaceholderConfigurer(encryptor);
DefaultResourceLoader defaultResourceLoader = new DefaultResourceLoader(); DefaultResourceLoader defaultResourceLoader = new DefaultResourceLoader();
placeholderConfigurer.setLocations(defaultResourceLoader.getResource("classpath:gjj.properties")); // 加载两个配置文件,确保 gjj.properties 中的 jdbc.* 属性和 gjj_bussiness.property 中的业务属性都能被解析
placeholderConfigurer.setLocations(
defaultResourceLoader.getResource("classpath:gjj.properties"),
defaultResourceLoader.getResource("classpath:gjj_bussiness.property")
);
// 不忽略无法解析的占位符,发现问题更早暴露
placeholderConfigurer.setIgnoreUnresolvablePlaceholders(false);
return placeholderConfigurer; return placeholderConfigurer;
} }
...@@ -55,5 +72,4 @@ public class EncryptorConfig { ...@@ -55,5 +72,4 @@ public class EncryptorConfig {
} }
} }
...@@ -15,15 +15,15 @@ FileTemplatPath=D:\\JavaFileDir ...@@ -15,15 +15,15 @@ FileTemplatPath=D:\\JavaFileDir
jdbc.type=oracle jdbc.type=oracle
jdbc.driver=oracle.jdbc.driver.OracleDriver jdbc.driver=oracle.jdbc.driver.OracleDriver
jdbc.url=ENC(O/MRgz1LcC4g+4JLVPeEEQYSJQ8MNNvUJ6ri4Izl5IdK1NEkMhRvmi+54sNI/HmoOOxZpcZY/64vTaXZvKBNQg==) jdbc.url=jdbc:oracle:thin:@192.168.101.196:1521:zfgjj
jdbc.username=GJJ80 jdbc.username=ZHFW80
jdbc.password=GJJ80_Hg41RG jdbc.password=ZHFW80_Hg41RG
jdbc.type.ss=oracle jdbc.type.ss=oracle
jdbc.driver.ss=oracle.jdbc.driver.OracleDriver jdbc.driver.ss=oracle.jdbc.driver.OracleDriver
jdbc.url.ss=ENC(O/MRgz1LcC4g+4JLVPeEEQYSJQ8MNNvUJ6ri4Izl5IdK1NEkMhRvmi+54sNI/HmoOOxZpcZY/64vTaXZvKBNQg==) jdbc.url.ss=jdbc:oracle:thin:@192.168.101.196:1521:zfgjj
jdbc.username.ss=GJJ80 jdbc.username.ss=ZHFW80
jdbc.password.ss=GJJ80_Hg41RG jdbc.password.ss=ZHFW80_Hg41RG
#jdbc.type=oracle #jdbc.type=oracle
#jdbc.driver=oracle.jdbc.driver.OracleDriver #jdbc.driver=oracle.jdbc.driver.OracleDriver
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
</aop:aspectj-autoproxy> </aop:aspectj-autoproxy>
<!-- 加载配置属性文件 --> <!-- 加载配置属性文件 -->
<!--<context:property-placeholder ignore-unresolvable="true" location="classpath:gjj.properties" />--> <!--<context:property-placeholder ignore-unresolvable="true" location="classpath:gjj.properties" />-->
<context:property-placeholder ignore-unresolvable="true" location="classpath:gjj_bussiness.property" /> <!--<context:property-placeholder ignore-unresolvable="true" location="classpath:gjj_bussiness.property" />-->
<!-- 加载应用属性实例,可通过 @Value("#{APP_PROP['jdbc.driver']}") String jdbcDriver <!-- 加载应用属性实例,可通过 @Value("#{APP_PROP['jdbc.driver']}") String jdbcDriver
方式引用 --> 方式引用 -->
...@@ -56,9 +56,8 @@ ...@@ -56,9 +56,8 @@
<!-- MyBatis begin --> <!-- MyBatis begin -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" /> <property name="dataSource" ref="dataSource" />
<property name="typeAliasesPackage" value="com.changda" /> <property name="typeAliasesPackage" value="com.changda.**.entity" />
<property name="typeAliasesSuperType" <property name="typeAliasesSuperType" value="com.changda.cd4j.foundation.core.persistence.BaseEntity" />
value="com.changda.cd4j.foundation.core.persistence.BaseEntity" />
<property name="mapperLocations" value="classpath*:/mappings/**/*.xml" /> <property name="mapperLocations" value="classpath*:/mappings/**/*.xml" />
<property name="configLocation" value="classpath:/mybatis-config.xml"></property> <property name="configLocation" value="classpath:/mybatis-config.xml"></property>
</bean> </bean>
......
...@@ -121,18 +121,18 @@ ...@@ -121,18 +121,18 @@
<activiti.version>5.22.0</activiti.version> <activiti.version>5.22.0</activiti.version>
</properties> </properties>
<repositories> <!-- <repositories>-->
<repository> <!-- <repository>-->
<id>nexus-central</id> <!-- <id>nexus-central</id>-->
<name>Central</name> <!-- <name>Central</name>-->
<url>http://192.168.101.124:8889/nexus/content/repositories/central/</url> <!-- <url>http://192.168.101.124:8889/nexus/content/repositories/central/</url>-->
</repository> <!-- </repository>-->
<repository> <!-- <repository>-->
<id>nexus-repos</id> <!-- <id>nexus-repos</id>-->
<name>Team Nexus Repository</name> <!-- <name>Team Nexus Repository</name>-->
<url>http://192.168.101.124:8889/nexus/content/repositories/thirdparty</url> <!-- <url>http://192.168.101.124:8889/nexus/content/repositories/thirdparty</url>-->
</repository> <!-- </repository>-->
</repositories> <!-- </repositories>-->
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
...@@ -812,17 +812,17 @@ ...@@ -812,17 +812,17 @@
<distributionManagement> <!-- <distributionManagement>-->
<snapshotRepository> <!-- <snapshotRepository>-->
<id>nexus-snapshots</id> <!-- <id>nexus-snapshots</id>-->
<name>nexus distribution snapshot repository</name> <!-- <name>nexus distribution snapshot repository</name>-->
<url>http://192.168.101.124:8889/nexus/content/repositories/snapshots/</url> <!-- <url>http://192.168.101.124:8889/nexus/content/repositories/snapshots/</url>-->
</snapshotRepository> <!-- </snapshotRepository>-->
<repository> <!-- <repository>-->
<id>nexus-3rd</id> <!-- <id>nexus-3rd</id>-->
<url>http://192.168.101.124:8889/nexus/content/repositories/thirdparty/</url> <!-- <url>http://192.168.101.124:8889/nexus/content/repositories/thirdparty/</url>-->
</repository> <!-- </repository>-->
</distributionManagement> <!-- </distributionManagement>-->
<build> <build>
...@@ -834,9 +834,9 @@ ...@@ -834,9 +834,9 @@
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<version>2.6</version> <version>2.6</version>
<configuration> <configuration>
<source>${java.version}</source> <!--<source>${java.version}</source>
<target>${java.version}</target> <target>${java.version}</target>
<showWarnings>true</showWarnings> <showWarnings>true</showWarnings>-->
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>
...@@ -856,10 +856,10 @@ ...@@ -856,10 +856,10 @@
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
<version>2.6</version> <version>2.6</version>
<configuration> <configuration>
<source>${java.version}</source> <!-- <source>${java.version}</source>
<target>${java.version}</target> <target>${java.version}</target>
<showWarnings>true</showWarnings> <showWarnings>true</showWarnings>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>-->
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
...@@ -901,10 +901,10 @@ ...@@ -901,10 +901,10 @@
</developer> </developer>
</developers> </developers>
<modules> <modules>
<module>gjjapp-web</module>
<module>gjjapp-common</module>
<module>gjjapp-db</module>
<module>gjjapp-gedai</module> <module>gjjapp-gedai</module>
<module>gjjapp-zhfwpt</module> <module>gjjapp-zhfwpt</module>
<module>gjjapp-db</module>
<module>gjjapp-common</module>
<module>gjjapp-web</module>
</modules> </modules>
</project> </project>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment