tm1-spring-boot-starter 0.1.1 API

The TM1 client as Spring Boot beans, configured from tm1.* properties.

Getting started

  1. Have a TM1 server to talk to. To run one on your own computer in Docker, follow Run TM1 on your own computer. You need your own licensed copy of TM1 Server.

  2. Add the starter to a Spring Boot 4 application. Gradle:

    implementation("io.skipcheck:tm1-spring-boot-starter:0.1.1")

    Maven:

    <dependency>
      <groupId>io.skipcheck</groupId>
      <artifactId>tm1-spring-boot-starter</artifactId>
      <version>0.1.1</version>
    </dependency>
  3. Tell it where TM1 is. The starter connects with the tm1 settings in application.yml; these are the defaults of a server set up with the link above:

    # src/main/resources/application.yml
    tm1:
      # Where TM1 is: the server's address, as for tm1-server on this computer
      address: http://localhost:8010
      # Who to log in as: tm1-server's default admin, with no password
      user: admin
      password: ""
      # With Cognos (CAM) security, also name the CAM namespace:
      # namespace: LDAP
    

    For a server elsewhere, change the address. Keep a real password out of the file, for example with password: ${TM1_PASSWORD} and an environment variable. Tm1Properties lists every property.

  4. Say hello. The starter builds a Tm1Client from those settings; ask for it, and use it. This prints the server's version and lists its cubes when the application starts:

    import org.springframework.boot.ApplicationRunner;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.context.annotation.Bean;
    
    import io.skipcheck.tm1.client.Tm1Client;
    import io.skipcheck.tm1.client.model.Cube;
    import io.skipcheck.tm1.client.odata.ODataQuery;
    
    @SpringBootApplication
    public class HelloTm1Application {
    
    	public static void main(String[] args) {
    		SpringApplication.run(HelloTm1Application.class, args);
    	}
    
    	// The starter built the client from the tm1 settings: just ask for it
    	@Bean
    	ApplicationRunner hello(Tm1Client tm1) {
    		return args -> tm1.session()
    			.version()
    			.doOnNext(version -> System.out.println("Hello from TM1 " + version))
    			.thenMany(tm1.cubes().modelCubes(ODataQuery.none().select(Cube.NAME)))
    			.doOnNext(cube -> System.out.println("  " + cube.name()))
    			.then()
    			.block(); // fine at startup; in a web request, return the Flux instead
    	}
    
    }
    

    Run it with ./gradlew bootRun (or mvn spring-boot:run):

    Hello from TM1 11.8.03500.6
      Plan_BudgetPlan
      SalesCube
      ...

Where next

Packages
Package
Description
Spring Boot auto-configuration for the TM1 client: for each TM1 server, named by tm1.servers.<name>.* or, for the server named default, tm1.*, Tm1ConnectionDetails (so @ServiceConnection can supply the connection) and beans for the session, the client and, when enabled, the session pool.