Tag: spring boot

使用Spring Boot和Spring集成与数据库支持的配置

对于spring boot +集成应用程序,我正在尝试从数据库加载配置,允许它通过@Value注释可以访问Spring的Environment和注入,并且可以通过外部化配置覆盖,如弹簧引导参考文档中所述。 外化配置部分 。 我遇到的问题是我的spring Integration XML包含无法解析的${input}属性占位符,因为在 Spring尝试加载XML配置之前 ,我无法加载数据库支持的配置。 应用程序的入口点: @SpringBootApplication public class TestApplication { public static void main(String[] args) { SpringApplication.run(TestApplication.class, args); } } 如何加载数据库配置: @Configuration public class DbPropertiesConfig { @Autowired private org.springframework.core.env.Environment env; @PostConstruct public void initializeDatabasePropertySourceUsage() { MutablePropertySources propertySources = ((ConfigurableEnvironment) env).getPropertySources(); try { // The below code will be replace […]

Spring Boot 1.2.5 Hibernate JPA嵌套了很多对很多关系

我有3个表如下 产品{id,title} Product_image {product_id,image_type_id,path,alt_text} Product_image_type {id,type_name} 我想要的结果对象是这样的: Product{ id, title, image_types[ { type_id, type_name, image [ { alt_text, path }, { alt_text, path } ] }, { type_id, type_name, image [ { alt_text, path } ] } ] } 我做了以下 产品类别: @ManyToMany(fetch = FetchType.LAZY, cascade = {CascadeType.ALL}) @JoinTable( name = “product_image”, joinColumns = { @JoinColumn(name […]

使用Angular 2客户端的Spring启动Birt报告生成损坏的PDF文件

我试图在spring启动应用程序中配置birt报告,客户端是一个角度2应用程序,这是我运行报告的地方: @PostConstruct public void startUp() { if(inputDir == null) throw new RuntimeException(“Cannot start application since birt report input directory was not specified.”); try { EngineConfig engineConfig = new EngineConfig(); engineConfig.getAppContext().put(“spring”, this.context); RegistryProviderFactory.releaseDefault(); Platform.startup(engineConfig); IReportEngineFactory reportEngineFactory = (IReportEngineFactory) Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY); birtReportEngine = reportEngineFactory.createReportEngine(engineConfig); } catch (BirtException e) { } reportOutputDirectory = env.getProperty(“birt_temp_file_output_dir”); } @Override public ByteArrayOutputStream runReport(Report […]

H2不在我的Spring Boot应用程序中创建/更新表。 我的实体出了什么问题?

我想通过使用Hibernate创建一个CRUD存储库来在H2数据库中保留一些数据。 我无法让数据库存储我的条目。 目前,我正在尝试通过制作样本条目来更新数据库期间实现这一点。 条目在日志中看起来很好,但不创建/更新/生成表。 为什么Hibernate在这种情况下无法创建表? (如果问题出在我的数据结构中) 这是我的实体, Game.java类(我试过没有@Column注释,没有区别.Id不是自动生成的,我需要每次都能输入自己的ID): @Entity @Table(name = “GAME”) public class Game { @Id @Column (name = “ID”) private long id; @Column (name = “NAME”) private String name; @Column(name = “STORYLINE”, length = 4000) private String storyline; @Column(name = “AGGREGATED_RATING”) @JsonProperty(“aggregated_rating”) private double aggregatedRating; @Column(name = “FIRST_RELEASE_DATE”) @JsonProperty(“first_release_date”) private long firstReleaseDate; @Embedded […]

部署Spring Boot 1.3.2 IBM WAS 8.5

我在使用完整配置文件在IBM Websphere 8.5.5.8上部署简单的spring boot Web时遇到了问题 默认情况下,WAS使用servlet 3.0和java 1.7。 应用程序没有太大作用,只显示一个“Hi – [current-date]”页面。 部署war文件时,我们在服务器日志输出中看到以下内容: [2/3/16 13:30:44:857 AST] 00000078 AdminHelper A ADMN1008I: An attempt is made to start the simpledemo_war application. (User ID = defaultWIMFileBasedRealm/wps_admin) [2/3/16 13:30:44:871 AST] 00000078 CompositionUn A WSVR0190I: Starting composition unit WebSphere:cuname=simpledemo_war in BLA WebSphere:blaname=simpledemo_war. [2/3/16 13:30:44:958 AST] 00000078 ApplicationMg A WSVR0200I: Starting application: […]

Spring启动:需要ServletContext来配置默认的servlet处理

我已将经典的spring框架应用程序转换为Spring Boot,现在我得到了这个: . ____ _ __ _ _ /\\ / ___’_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | ‘_ | ‘_| | ‘_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ‘ |____| .__|_| |_|_| […]

Spring Data返回List

我有这个存储库: @Repository public interface ProductRepository extends JpaRepository{ @Query(“SELECT p.textToSearch as text, count(*) as counter FROM Product p GROUP BY text_to_search ORDER BY counter DESC”) List findTopProducts(); } TopProductDTO类的位置是: public class TopProductDTO { public TopProductDTO() {} private String text; private Integer counter; // Getters and Setters are omited } 但是当我执行代码时 List topProducts = productRepository.findTopProducts(); 它返回一个 List […]

如何以动态方式创建Spring Beans。 使用Quartz SchedulerFactoryBean

我有一个QuartzJobConfig类,我注册了我的Spring-Quartz-Beans 。 我遵循了SchedulerFactoryBean , JobDetailFactoryBean和CronTriggerFactoryBean的指令。 我的作业在应用程序外部的yaml文件中配置。 意味着我必须在应用程序启动时动态创建Bean。 我的配置: channelPartnerConfiguration: channelPartners: – code: Job1 jobConfigs: – schedule: 0 * * ? * MON-FRI name: Job1 daily hotel: false allotment: true enabled: true – schedule: 30 * * ? * MON-FRI name: Job2 weekly hotel: true allotment: false enabled: true … 我的配置类: @Configuration public class QuartzJobConfig implements […]

在springboot反序列化器中包含带jackson的root对象

如何将我的jackson反序列化器中的objeto root包含在spring-boot中? 我尝试放入application.properties spring.jackson.deserialization.UNWRAP_ROOT_VALUE=true 我尝试使用一个配置器 @Configuration public class JacksonConfig { @Bean public Jackson2ObjectMapperBuilder jacksonBuilder() { Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder(); builder.featuresToEnable(DeserializationFeature.UNWRAP_ROOT_VALUE); builder.indentOutput(true).dateFormat(new SimpleDateFormat(“dd/MM/yyyy HH:mm:ss”)); builder.indentOutput(true); return builder; } } 我把注释放在我的classe中 @JsonRootName(“contato”) public class TbContato extends EntityBase { 但是没有工作我得到了这个回报: { “cdContato”: 12, “dtContato”: “03/08/2015 16:04:43”, “cdUsuario”: null, “nmParte”: “Fabio Ebner”, “nmEmailParte”: “fabioebner@gmail.com”, “nmAssunto”: “Assuntttoooo”, “dsMensagem”: “mensagem […]

Spring LDAP和Spring Boot配置

我有教育问题: 有一个带有用户及其密码的Windows Server 2003(AD)虚拟机。 建立与机器的连接(IP:192.168.56.101:389)。 Web应用程序的目的是使用户能够在AD中更改其密码。 问题:无法配置与windws server 2003的连接。 我从本教程开始https://spring.io/guides/gs/authenticating-ldap/ 当我尝试以“杰克伍德”登录并通过“1234”时,我收到了错误消息。 org.springframework.security.authentication.InternalAuthenticationServiceException: Uncategorized exception occured during LDAP processing; nested exception is javax.naming.NamingException: [LDAP: error code 1 – 00000000: LdapErr: DSID-0C090627, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, vece ]; remaining name ‘cn=Jack Wood,cn=Users’ 请检查application.properties […]